Hello sekitaka.
It would be nice to be able to run the program on the Docker container not only in production but also with the Pycharm Run command in the local development environment. If you can use the Docker container in the same environment as the production, you will be less addicted to it.
This time, I will introduce how to make Pycharm interpreter python on Docker container.
I'm getting the image to use for the container. Since this is an example, I'm just using the python3 environment of Docker Hub. In reality, it is best to use an image that is optimized for each development.
docker pull python:3
Make sure Docker integration
is enabled in Preferences> Plugins.
In Preferences> Project> Project Interpreter, press the button to the right of Project Interpreter and select ʻAdd Remote`.
In the dialog that opens, select Docker as the remote interpreter type and select python: 3
, which you just pulled ʻImage name`.
Then, the Docker you just created can be selected as an interpreter in the Project Interpreter options, so select it.
This completes the settings. If you run the program that displays the version as a trial, you can see that python on Docker is running as shown below.
By integrating Docker with the IDE, you can make development more efficient. It will be an environment where you can start development even if you are not very familiar with how to use Docker itself, so it seems to be useful for projects developed by multiple people.
Recommended Posts