tag or partial image ID. Can be local or remote. Compose will attempt to pull if it doesnot exist locally:
image: ubuntu image: a4c42
path to a directory containing a Dockerfile. When the value supplied is a relative path, it is interpreted as relative to the location of the yml file itself. This directory is also the build context that is sent to the Docker daemon.
Compose will build and tag it with a generated name and use that image thereafter
compose will use an alternate file to build with
expose ports. Either specify both ports(HOSTPORT:CONTAINPORT) or just the container port:
ports: - "3000" - "5601:5601" - "39200:9200" - "127.0.0.1:9200:9200"
When mapping ports in the HOST:CONTAINER format, you may experience erroneous results when using a container port lower than 60, because YAML will parse numbers in the format xx:yy as sexagesimal (base 60). For this reason, we recommend always explicitly specifying your port mappings as strings.
Expose ports without publishing them to the host machine - they will only be accessible to linked services:
expose: - "6379" - "9200"
mount paths as volumes, optionally specifying a path on the host machine(HOST:CONTAINER) or an access mode(HOST:CONTAINER:ro):
volumes: - /var/lib/mysql - ~/configs:/etc/configs/:ro
mount all of the volumes from another services or container:
volues_from: - service_name - container_name
add environment variables. You can use either an array or a dictionary.
Environment variables with only a key are resolved to their values on the machine Compose is running on, which can be helpful for secret or host-specific values:
environment: RACK_ENV: development SESSION_SECRET: environment: - RACK_ENV=development - SESSION_SECRET
Add environment variables from a file. Can be a single value or a list.
If you have specified a Compose file with docker-compose -f FILE, paths in env_file are relative to the directory that file is in.
forces running contenters to stop by sending a
SIGKILL signal. Optionally the signal can be passed:
docker-compose kill -s SIGTERM
run a one-off command on a service
docker-compose run web python manage.py shell
In this example, compose will start
web service then run
manage.py shell in python. Note that by default, linked services will also be started, unless they are already running.
stops running containers without removing them. They can be started again with
builds, creates, starts, and attaches to containers for a service.
Linked services will be started, unless they are already running.
docker-compose up will aggregate the output of each container and when it exits, all containers will be stopped.
docker-compose up -d will start the containers in the background and leave them running.
docker-compose up will stop and recreate existing containers. If you do not want containers stopped and recreated, use
docker-compose up --no-recreate . This will still start any stopped containers, if needed.
|--verbose||shows more output|
|-v, --version||prints version and exits|
|-f, --file FILE|
|specify what files to read configuration from. If not provided, compose will look for docker-compose.yml|
|-p, --project-name NAME|
|specifies an alternate project name( default: current directory name)|
Sets the project name, which is prepended to the name of every container started by Compose
Specify what file to read configuration from. If not provided, Compose will look for docker-compose.yml in the current working directory, and then each parent directory successively, until found.
Sets the URL of the docker daemon. As with the Docker client, defaults to unix:///var/run/docker.sock.
When set to anything other than an empty string, enables TLS communication with the daemon.
Configures the path to the ca.pem, cert.pem, and key.pem files used for TLS verification. Defaults to ~/.docker.