Configure an interpreter using Docker Compose
Configuring Docker Compose as a remote interpreter
Let's now define a remote interpreter based on Docker-Compose.
Do one of the following:
Click the Python Interpreter selector and choose Add New Interpreter.
Press Control+Alt+S to open Settings and go to . Click the Add Interpreter link next to the list of the available interpreters.
Click the Python Interpreter selector and choose Interpreter Settings. Click the Add Interpreter link next to the list of the available interpreters.
Select On Docker Compose.
Select an existing Docker configuration in the Server dropdown.
Alternatively, select Create new and perform the following steps to create a new Docker configuration:
- Create a Docker configuration
Click to add a Docker configuration and specify how to connect to the Docker daemon.
The connection settings depend on your Docker version and operating system. For more information, refer to Docker connection settings.
The Connection successful message should appear at the bottom of the dialog.
For more information about mapping local paths to the virtual machine running the Docker daemon when using Docker on Windows or macOS, refer to Virtual machine path mappings for Windows and macOS hosts. You will not be able to use volumes and bind mounts for directories outside of the mapped local path.
This table is not available on a Linux host, where Docker runs natively and you can mount any directory to the container.
In Configuration files, specify the docker-compose.yml file. Also select the service.
Wait until PyCharm creates and configures a new target:
Next, select an interpreter to use in the container. You can choose any virtualenv or conda environment that is already configured in the container, or select a system interpreter.
The configured remote interpreter is added to the list.