PyCharm 2023.3 Help

Docker run configurations

Use Docker run configurations to build Docker images and run containers from PyCharm. For example, you can run a container with the database used by your application backend. Or you can build an image with your application binary, dependencies, and any other necessary files. This is called "dockerizing" an application.

Create a Docker run configuration

  1. In the main menu, go to Run | Edit Configurations.

  2. In the Run/Debug Configurations dialog, click The Add New Configuration button, expand the Docker group, and select the desired type of run configuration.

PyCharm provides the following types of Docker run configurations:

Docker Image

Created automatically when you run a container from an existing image. For more information, refer to Docker Image run configuration.

Dockerfile

Created automatically when you run a container from a Dockerfile. For more information, refer to Dockerfile run configuration.

Docker Compose

Created automatically when you run a multi-container Docker application from a Docker Compose file. For more information, refer to Docker compose run configuration.

Run Docker containers before another run configuration

You can set any Docker run configuration as a Before launch task for another run configuration. For example, if your application relies on a running database, you can automatically run a Docker container with the database every time you run your application from sources.

  1. In the run configuration dialog, click Modify options and select Add before launch task.

  2. Click the Add button in the Before launch group, select Run Another Configuration, and then select the necessary Docker run configuration.

Last modified: 27 December 2023