The docker-compose tool provides sophisticated orchestration functionality with a handful of commands. In this section, we will list out the docker-compose options and commands:
docker-compose [<options>] <command> [<args>...]
The docker-compose tool supports the following options:
- -f, --file <file>: This specifies an alternate file for docker-compose (default is the docker-compose.yml file)
- -p, --project-name <name>: This specifies an alternate project name (default is the directory name)
- --verbose: This shows more output
- -v, --version: This prints the version and exits
- -H, --host <host>: This is to specify the daemon socket to connect to
- -tls, --tlscacert, --tlskey, and --skip-hostname-check: The docker-compose tool also supports these flags for Transport Layer Security (TLS)
The docker-compose tool supports the following commands:
- build: This command builds or rebuilds services.
- bundle: This is used to create a Docker bundle from the compose file, this is still an experimental feature on Docker 1.13.
- config: This is a command to validate and display the compose file.
- create: This creates the services defined in the compose file.
- down: This command is used to stop and remove containers and networks.
- events: This can be used to view the real-time container life cycle events.
- exec: This enables you to run a command in a running container. It is used predominantly for debugging purposes.
- kill: This command kills running containers.
- logs: This displays the output from the containers.
- pause: This command is used to pause services.
- port: This prints the public port for a port binding.
- ps: This lists the containers.
- pull: This command pulls the images from the repository.
- push: This command pushes the images to the repository.
- restart: This is used to restart the services defined in the compose file.
- rm: This removes the stopped containers.
- run: This runs a one-off command.
- scale: This sets a number of containers for a service.
- start: This command starts services defined in the compose file.
- stop: This stops services.
- unpause: This command is used to unpause services.
- up: This creates and starts containers.
- version: This prints the version of Docker Compose.