Docker compose run configuration
Use this type of configuration to run multi-container Docker applications.
Docker uses the docker compose command to define, configure, and run multi-container applications. The main command that builds, creates, starts, and attaches to containers is docker compose up.
By default, the Docker Compose configuration has the following options:
Item | Description |
---|---|
Name | Specify a name for the run configuration to quickly identify it among others when editing or running. |
Allow multiple instances | Allow running multiple instances of this run configuration in parallel. By default, it is disabled, and when you start this configuration while another instance is still running, WebStorm suggests stopping the running instance and starting another one. This is helpful when a run configuration consumes a lot of resources and there is no good reason to run multiple instances. |
Store as project file | Save the file with the run configuration settings to share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project. By default, it is disabled, and WebStorm stores run configuration settings in .idea/workspace.xml. |
Server | Select the Docker daemon connection to use for the run configuration. |
Compose files | Specify the compose files that define the necessary services. Docker Compose builds the configuration in the specified order, so any subsequent files override and add to the fields of the same service in previous files. This is similar to using the |
Services | Specify the services to build, create, and start. Click to select services that are listed in the YML file. |
Before launch | Specify a list of tasks to perform before starting the run configuration. For example, run another configuration, build the necessary artifacts, run some external tool or a web browser, and so on. Click or press Alt+Insert to add one of the available tasks. Move tasks in the list using and to change the order in which to perform the tasks. Select a task and click to edit the task. Click to remove the selected task from the list. |
Show this page | Show the run configuration settings before actually starting it. |
Activate tool window | Depending on the type of configuration, open the Run, Debug, or Services tool window when you start this run configuration. If this option is disabled, you can open the tool window manually:
|
Use the Modify options menu to add advanced options to the run configuration:
Item | Description |
---|---|
Project name | Specify an alternate project name for Docker Compose. By default, it is the name of the current directory. This is similar to using the |
Environment variables | Specify the Docker Compose environment variables. These are used only by the Docker Compose process. They are not passed on to any of the containers. |
Environment variables file | Specify the path to a custom environment file that defines the Docker Compose environment variables. This is similar to using the By default, the Docker Compose run configuration looks for a file named .env in the directory with the Docker Compose file. |
Enable BuildKit | Use the BuildKit backend when building the images. This is similar to setting the |
Remove volumes on `down | When stopping and removing containers, also delete named volumes declared in the Docker Compose file and anonymous volumes attached to containers. This is similar to using the |
Enable compatibility mode | Convert v3 service definitions into v2 compatible parameters. This is similar to using the |
Remove images on `down | Configure which images should be removed when stopping and removing containers. You can choose to remove all images used by any service or only images that don't have a custom tag set in the This is similar to using the |
Timeout | Set a timeout in seconds to forcefully terminate containers that won't shutdown gracefully. Docker usually tries to gracefully terminate any container with This is similar to using the |
Exit code | Return the exit code of the selected service container. Whenever a container in the selected service stops, return its exit code and stop all other containers in the service. This is similar to using the |
Override scale | Set the number of containers to start for each service. This option overrides the This is similar to using the |
Recreate dependencies | Recreate dependent containers when starting a service. This is similar to using the |
Recreate anonymous volumes | Recreate anonymous volumes instead of retrieving data from the previous containers. This is similar to using the |
Remove orphans | Remove containers for services not defined in the Docker Compose file. This is similar to using the |
Start | Configure which services to start:
|
Attach to | Configure for which containers to show output streams:
|
Recreate containers | Configure which containers to stop and replace by new ones:
|
Build | Configure which images to build before starting containers:
|
Stop Containers | Configure how to stop containers in a service. By default, Docker Compose doesn't stop other containers in a service. You have to stop them manually. However, you can choose to stop all containers if any container in a service stops. This is similar to using the |