Introduction to Docker Compose

Fri Jun 10, 2016

Docker CEO here.


Docker Compose (originally Fig) is written in Python.

Docker-Compose provides a template for running one or more containers

Most of the command line options for ”docker run” can be specified in the docker-compose.yml file Simplifies and documents what is required to run the docker containers

Docker-compose allows to have a single document for all environments via injection of Environment variables

Developers can start/stop/rebuild containers without any deep knowledge of Docker

Configuration is in one YAML file: ‘docker-compose.yml’ YAML is the cleanest data format

Docker-Compose has traditionally been focused on development and testing workflows on a single host.

Using Compose is basically a three-step process

  • Define your app’s environment with a “Dockerfile” so it can be reproduced anywhere
  • Define the services that make up your app in “docker-compose.yml” so they can be run together in an isolated environment
  • Run “docker-compose up” and Docker Compose will start and run your entire app


Docker for Mac and Docker for Windows includes both Engine and Compose, so Mac and Windows users do not need to install Docker Compose separately.

For Linux users, follow the directions here:

Upgrade containers

Reference: To bring up all the service containers with a simple docker-compose up starts everything. However, what if you want to replace an existing container without tearing down the entire suite of containers? do it with a single command

 docker-compose up -d --no-deps --build <service_name>

NEXT: perhaps add to my powerpoint deck?

NOTE: libcompose also referenced in ael.txt

docker-compose (originally Fig) is Python, rancher-compose uses libcompose in Go, which rancher contributed to Docker. lib-compose is currently maintained by Docker and added Compose V2 support in July. Lib-compose is used by rancher-compose, openshift, amazon-ecs-cli, compose2kube and other projects.


Docker environment variable file

Finally implemented 11/13/2016  for docker-aws
Env file for AWS secret key
(Until u can setup hashi vault)

done with 'env_file'

decided against updating used goodies with awscli.  probably not needed - just run separate containers?
jliu@JEFFREYs-MacBook-Pro ~ $ docker network inspect $(docker network ls -q) | | jq -r '.[].Name , .[].IPAM.Config'


for i in $(docker network ls -q); do docker network inspect $i | jq -r '.[].Name, .[].IPAM.Config'; done

version: '2'

    image: busybox
    command: ifconfig

    driver: bridge
    driver_opts: "false"
      driver: default
      - subnet: