docker-compose
docker-compose define and run multi-container applications with Docker.[1]
Documentation
- Compose command-line reference [EN]
- Compose file reference [EN]
- Declare default environment variables in file [EN]
- Compose CLI environment variables [EN]
Syntax
docker-compose [GLOBAL-PARAMETER ...] SUBCOMMAND [PARAMETER ...]
Subcommands & Parameters
- Global parameters
- The following parameters can be used with the subcommands below:
- -f FILE, --file FILE
- Specify an alternate compose FILE (default: docker-compose.yml).
- -p NAME, --project-name NAME
- Specify an alternate project NAME (default: directory name).
- config
- Validate and view the Compose file.
- -q, --quiet
- Only validate the configuration, don't print anything.
- --services
- Print the service names, one per line.
- --volumes
- Print the volume names, one per line.
- down
- Stops containers and removes containers, networks, volumes, and images created by up.
- --rmi TYPE
- Remove images. TYPE must be one of:
- all: Remove all images used by any service.
- local: Remove only images that don't have a custom tag set by the 'image' field.
- -v, --volumes
- Remove named volumes declared in the 'volumes' section of the Compose file and anonymous volumes attached to containers.
- exec
- This is the equivalent of docker exec. With this subcommand you can run arbitrary commands in your services.
- -d, --detach
- Detached mode: Run command in the background.
- -e KEY=VAL, --env KEY=VAL
- Set environment variables (can be used multiple times).
- --privileged
- Give extended privileges to the process.
- -u USER, --user USER
- Run the command as this USER.
- -w PATH, --workdir PATH
- PATH to workdir directory for this command.
- start
- Starts existing containers for a service.
- stop
- Stops running containers without removing them.
- up
- Builds, (re)creates, starts, and attaches to containers for a service.
- -d, --detach
- Detached mode: Run containers in the background, print new container names.
- --force-recreate
- Recreate containers even if their configuration and image haven't changed.