April 29, 2017

November 25, 2019

How to use Docker with PyCharm

What you need is:

  1. Docker - https://docs.docker.com/engine/installation/
  2. docker-compose - https://docs.docker.com/compose/install/
  3. PyCharm ;-)

I use PyCharm in 2017.12 version but even with previous ones this tutorial should work correctly.

First you need to configure Docker. Go to File -> Settings and find Docker section (you can use search bar).

Just add a new Docker, fill the API URL and Docker Compose executable inputs. When everything is added correctly you should see a "Connection successful" message.

Now you need to configure Docker all your projects. Once again go to the settings, find project configuration and choose "Project Interpreter" section.

Click settings icon and choose "Add Remote".

Configure project:

  • Server: choose the correct Docker configuration
  • Configuration file(s): Add a paths to your project docker-compose.yml files
  • Service: Choose Docker service/container which should be used

Click OK.

Now you need to wait some time because PyCharm needs to build own Docker container and scan everything. After that operation PyCharm should be able see every package installed in the container and you should be able to use for example "Go To" command or Docker tools from Pycharm.

© 2020 Przemysław Kołodziejczyk