Get Started
Quickstart containers Understand the architecture
Migrate to Engine 1.10 Breaking changes Deprecated Engine Features FAQ
Release Notes
Learn about Dockerfiles and Docker Cloud Back up data volumes Create a proxy or load balancer Install the Deploy to Docker Cloud button Integrate with Slack Push images to Docker Cloud SSHing into a Docker Cloud-managed node Upgrade Docker Engine on a node Use the Docker Cloud Agent Using the Docker Cloud CLI
API reference
Quickstart contribution FAQ for contributors Where to chat or get help Style guide for Docker documentation

Stack YAML reference

A stack is a collection of services that make up an application in a specific environment. Learn more about stacks here. A stack file is a file in YAML format that define one or more services, similar to a docker-compose.yml file but with a few extensions. The default name for this file is docker-cloud.yml.

Below is an example docker-cloud.yml:

lb:
  image: dockercloud/haproxy
  links:
    - web
  ports:
    - "80:80"
  roles:
    - global
web:
  image: dockercloud/quickstart-python
  links:
    - redis
  target_num_containers: 4
redis:
  image: redis

Each key defined in docker-cloud.yml will create a service with that name in Docker Cloud. Each service is a dictionary whose possible keys are documented below. The image key is mandatory. Other keys are optional and are analogous to their Docker Cloud Service API counterparts.

image

The image used to deploy this service.

image: drupal
image: dockercloud/hello-world
image: quay.io/borja/redis

command

Override the default command in the image.

command: echo 'Hello World!'

environment

A list of environment variables to be added in the service containers on launch (overriding any image-defined environment variables). You can use either an array or a dictionary.

environment:
    PASSWORD: my_password
environment:
  - PASSWORD=my_password

When using the Docker Cloud CLI to create a stack, you can use the environment variables locally defined in your shell to define those in the stack. This is convenient if you don’t want to store passwords or any other sensitive information in your stack file:

environment:
  - PASSWORD

labels

Add metadata to containers using Docker Engine labels. You can use either an array or a dictionary.

It’s recommended that you use reverse-DNS notation to prevent your labels from conflicting with those used by other software.

labels:
  com.example.description: "Accounting webapp"
  com.example.department: "Finance"
  com.example.label-with-empty-value: ""

labels:
  - "com.example.description=Accounting webapp"
  - "com.example.department=Finance"
  - "com.example.label-with-empty-value"

Link to another service. Either specify both the service unique name and the link alias (SERVICE:ALIAS), or just the service unique name (which will also be used for the alias). If the target service belongs to this stack its service unique name is its service name. If the target service does not belong to any stack its service unique name is its service name. If the target service belongs to another stack its service unique name is its service name plus the service stack name, separated by “.”.

links:
 - mysql
 - redis:cache
 - amqp.staging:amqp

Environment variables will be created for each link that Docker Cloud resolves to the containers IPs of the linked service. More information here.

ports

Expose ports. Either specify both ports (HOST:CONTAINER), or just the container port (a random host port will be chosen). udp ports can be specified with a /udp suffix.

ports:
 - "80"
 - "443:443"
 - "500/udp"
 - "4500:4500/udp"
 - "49022:22"

expose

Expose ports without publishing them to the host machine - they’ll only be accessible from your nodes in Docker Cloud. udp ports can be specified with a /udp suffix.

expose:
 - "80"
 - "90/udp"

volumes

Mount paths as volumes, optionally specifying a path on the host machine (HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).

volumes:
 - /etc/mysql
 - /sys:/sys
 - /etc:/etc:ro

volumes_from

Mount all of the volumes from another service by specifying a service unique name. If the target service belongs to this stack its service unique name is its service name. If the target service does not belong to any stack its service unique name is its service name. If the target service belongs to another stack its service unique name is its service name plus the service stack name, separated by “.”. Learn more here.

volumes_from:
 - database
 - mongodb.staging

tags

Indicates the deploy tags to select the nodes where containers are created.

tags:
	- staging
	- web

target_num_containers

The number of containers to run for this service (default: 1).

target_num_containers: 3

restart

Whether the containers for this service should be restarted if they stop (default: no, possible values: no, on-failure, always).

restart: always

autodestroy

Whether the containers for this service should be terminated if they stop (default: no, possible values: no, on-success, always).

autodestroy: always

deployment_strategy

Container distribution among nodes (default: emptiest_node, possible values: emptiest_node, high_availability, every_node). Learn more here.

deployment_strategy: high_availability

sequential_deployment

Whether the containers should be launched and scaled in sequence (default: false). Learn more here.

sequential_deployment: true

roles

A list of Docker Cloud API roles to grant the service. The only supported value is global, which creates an environment variable DOCKERCLOUD_AUTH used to authenticate againts Docker Cloud API. Learn more here.

roles:
	- global

autoredeploy

Whether to redeploy the containers of the service when its image is updated in Docker Cloud registry (default: false).

autoredeploy: true

privileged

Whether to start the containers with Docker Engine’s privileged flag set or not (default: false).

privileged: true

net

Networking mode. Only “bridge” and “host” options are supported for now.

net: host

pid

Sets the PID mode to the host PID mode. This turns on sharing between container and the host operating system the PID address space. Containers launched with this (optional) flag will be able to access and manipulate other containers in the bare-metal machine’s namespace and vise-versa.

pid: "host"

dns

Custom DNS servers. Can be a single value or a list.

dns: 8.8.8.8
dns:
  - 8.8.8.8
  - 9.9.9.9

Custom DNS search domains. Can be a single value or a list.

dns_search: example.com
dns_search:
  - dc1.example.com
  - dc2.example.com

cap_add, cap_drop

Add or drop container capabilities. See man 7 capabilities for a full list.

cap_add:
  - ALL
cap_drop:
  - NET_ADMIN
  - SYS_ADMIN

devices

List of device mappings. Uses the same format as the --device docker client create option.

devices:
  - "/dev/ttyUSB0:/dev/ttyUSB0"

extra_hosts

Add hostname mappings. Use the same values as the docker client --add-host parameter.

extra_hosts:
  - "somehost:162.242.195.82"
  - "otherhost:50.31.209.229"

security_opt

Override the default labeling scheme for each container.

security_opt:
  - label:user:USER
  - label:role:ROLE

cgroup_parent

Specify an optional parent cgroup for the container.

cgroup_parent: m-executor-abcd

Single value keys analogous to its docker run counterpart

working_dir: /app
entrypoint: /app/entrypoint.sh
user: root
hostname: foo
domainname: foo.com
mac_address: 02:42:ac:11:65:43
cpu_shares: 512
cpuset: 0,1
mem_limit: 100000m
memswap_limit: 200000m
privileged: true
read_only: true
stdin_open: true
tty: true

Docker-compose non-supported keys

Docker Cloud.yml has been designed with docker-compose.yml in mind to maximize compatibility, but the following keys are not supported:

build
external_links
env_file
Mar 5, 2016 at 1:15am (PST) { "docker/apidocs": { "ref": "master", "repos": [ "git@github.com:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/cloud-api-docs": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/cloud-api-docs-layout": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/compose": { "ref": "docs", "repos": [ "git@github.com:docker/compose.git" ], "sha": "9da9555f10abe628e7742476af3f10bd89f68b75" }, "docker/docker": { "ref": "docs", "repos": [ "git@github.com:docker/docker.git" ], "sha": "0e63b073ac8f33335a4d4df3f2aa22120e0b7f43" }, "docker/docker-cloud": { "ref": "master", "repos": [ "git@github.com:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/docker-hub": { "ref": "master", "repos": [ "git@github.com:docker/hub2-demo.git" ], "sha": "73ccb2d678ab0cd83067f0c7ef6f3923d750c7bd" }, "docker/docker-trusted-registry": { "ref": "master", "repos": [ "git@github.com:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/docs-base": { "ref": "master", "repos": [ "git@github.com:docker/docs-base.git" ], "sha": "5a4cfac3c4d156eda45080c7dcdd2a4c41e08067" }, "docker/kitematic": { "ref": "docs", "repos": [ "git@github.com:docker/kitematic.git" ], "sha": "856a989d834f7fcbcb9bba687539fb159228f6b8" }, "docker/machine": { "ref": "docs", "repos": [ "git@github.com:docker/machine.git" ], "sha": "21edf30337dc5996b5d785ce54d68b4020242f57" }, "docker/notary": { "ref": "docs", "repos": [ "git@github.com:docker/notary.git" ], "sha": "dfeb51f54f2b0cdf20cb55427b7cc8ea2d1cdd0a" }, "docker/opensource": { "ref": "master", "repos": [ "git@github.com:docker/opensource.git" ], "sha": "b994cdd1f74b0aeb0b51fda1249a0c4c8efbf0d0" }, "docker/registry": { "ref": "docs", "repos": [ "git@github.com:docker/distribution.git" ], "sha": "a5bd3e61441873ba6cb40480bda58176733fedb9" }, "docker/swarm": { "ref": "docs", "repos": [ "git@github.com:docker/swarm.git" ], "sha": "b43a2c21c4017726cd9cb17ef9b16f2eef6d1159" }, "docker/toolbox": { "ref": "master", "repos": [ "git@github.com:docker/toolbox.git" ], "sha": "de267d701f94035549ea03e68047d85534286f85" }, "docker/tutorials": { "ref": "master", "repos": [ "git@github.com:docker/tutorials.git" ], "sha": "7af2622fe68a30684d971e4bf3ca7988902e5e26" }, "docker/ucp": { "ref": "docs", "repos": [ "git@github.com:docker/orca.git" ], "sha": "8cd10936a1e063b9be0d5c04de7311a1b2cb25cf" }, "docs.docker.com": { "ref": "refs/heads/v1.10-03-04-2016-165411", "repos": [ "git@github.com:moxiegirl/docs.docker.com.git", "git@github.com:docker/docs.docker.com.git" ], "sha": "5d156add0cb35c1b8f7d2dc1e08f04bd5725792b" } }