Introduction
Laymen explanation
Technical explanation
Install docker-compose tool
$curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-$compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Remember to configure environment variable COMPOSE_API_VERSION
COMPOSE_API_VERSION configuration
$export COMPOSE_API_VERSION=auto
Above environment allows docker-compose client to automatically detect the client version
Docker compose supports YAML syntax for configuration data.
Example script
$ cat config.txt
DUT-BRIDGE_0:
container_name: DUT-BRIDGE_0_my
image: ubuntu:14.04
ports:
- 22
- 80
tty: true
privileged: true
ulimits:
core: -1
Example command
$docker-compose -f config.txt up -d
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8fc9c5e3699b ubuntu:14.04 "/bin/bash" 4 seconds ago Up 2 seconds 0.0.0.0:32792->22/tcp, 0.0.0.0:32793->80/tcp DUT-BRIDGE_0_my
Above command shows a docker container with name DUT-BRIDGE_0_my
Ref: https://serversforhackers.com/c/div-variables-in-docker-compose
Use -E option
Ref: https://forums.docker.com/t/docker-compose-not-seeing-environment-variables-on-the-host/11837/7
Add user to docker group
Ref: https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo
https://docs.docker.com/compose/install/
http://stackoverflow.com/questions/29727171/docker-compose-up-leads-to-client-and-server-dont-have-same-version-client
https://en.wikipedia.org/wiki/YAML