PyCharm 2017.2 Help

Configuring Remote Interpreters via Docker

This feature is supported in the Professional edition only.

Prerequisites

Limitation

As of this writing, on Windows and MacOS platforms running, debugging and profiling applications is only possible for the projects residing in the user home directory. If necessary, configure other directories in the VirtualBox settings.

Docker Machine on Linux does not share user home folder, and any other folders as well. Thus, for running, debugging and profiling applications, the user should add shared folders with the project sources to the VirtualBox Docker virtual machine manually. These shared folders on VM should be mapped one to one to the folders on the host Linux machine, i.e. (host) /home/user <=> /home/user (VM) or (host) /home/my/project <=> /home/my/project (VM)

Configuring remote interpreter using Docker

To set up a Python interpreter inside a Docker container for your project, follow these steps:

  1. In the Project Interpreter page of the Settings/Preferences dialog box, click /help/img/idea/2017.2/cogwheel_framed.png, and then choose Add Remote.
  2. From the Configure Remote Python Interpreter dialog box that opens, choose the option Docker:
    /help/img/idea/2017.2/py_choose_docker.png
  3. If the required Docker machine is not available, click New, and in the dialog box that opens, specify the machine name, API URL, and the certificates folder.
    If you want to import credentials of an existing Docker machine, select the corresponding check box.

The configured remote interpreter is set as the project interpreter. Now you can run, debug and profile your application using Python inside a Docker container.

Note that for the project interpreters created via Docker, the field Path mappings is always empty, and packages toolbar is not available.

The buttons on this toolbar are disabled for the Docker interpreters:

/help/img/idea/2017.2/py_packages_toolbar_for_docker.png

All the packages should be already installed in the Docker image. If some packages are missing, then you will have to create a new Docker image, as described on the page Quickstart Guide: Compose and Django.

Last modified: 26 October 2017

See Also