PyCharm 2017.3 Help

Docker

This feature is only supported in the Professional edition.

The following is only valid when Docker Integration and Python Docker plugins are installed and enabled!

Prerequisites

Make sure that the following prerequisites are met:

Overview of Docker support

The Docker integration plugin adds the following to PyCharm:

Configuring PyCharm to work with Docker

  1. In the Settings / Preferences dialog, open the Docker page under Build, Execution, Deployment, and click add to create a Docker configuration:
    py docker settings
  2. In the Docker page, provide the following information:
    • Name. Here it is MyDocker.
    • API URL. Here it is http://localhost:2375.
    • Certificates folder. Here it is /Users/<user name>/.docker/machine/machines/default
  3. Apply the changes and close the Settings / Preferences dialog.

After that, you can configure a remote interpreter using Docker:

py choose docker

Creating a Docker Deployment run/debug configuration

Having set up Docker, create the run/debug configuration. The Docker Deployment run/debug configuration can be used to download and build the Docker images, to create and start the Docker containers.

First, in the Deployment tab of the Docker Deployment run/debug configuration dialog, specify the following:

  • Name. Here it is Start Docker.
  • Server. Here Docker server is selected from the drop-down list.
  • Deployment. Here Docker Image is selected.
  • Image ID. Here it is mysite.
  • Container. Here it is Docker .
py docker run config

Next, in the Container tab, specify the necessary parameters.
At this point we are interested in exposing 80 port of the container to be available from our local machine, so we should configure a port binding for that:

Container port: 80, Protocol: tcp, Host IP: empty, Host port: 8080

Apply changes and close the Docker Deployment run/debug configuration dialog.

Working with Docker in PyCharm

As all the tools are installed, and the integration is configured, the recently created Start Docker Run/Debug Configuration can be launched:

rm docker run config2

The Docker tool window opens, updating you on the provisioning status and the current state of all your Docker containers.

rm docker app servers tw
Last modified: 28 March 2018

See Also