I do use
fig (has now been "renamed" to
docker-compose) to adress this type of problem. One can denote the individual docker containers involved in a "deployment" (as I will call it for now, please anyone: post a comment if you know better terminology. Bear with me, I'm german). This is done in YAML notation in a file named
docker-compose.yml if you have migrated to docker-compose). You are then able to start, stop, etc. the described set of containers via commands like
The most convenient command to get things running would be
fig up (builds all contains and starts all of them like a single application with combined console output).
To do this in scripts, in a deamon like fashion, the -d parameter is of use:
fig up -d runs the whole shebang like a single daemon.
Link to Fig documentation: http://www.fig.sh
Same for docker-compose: https://docs.docker.com/compose/
I will now post you a complete example of a Gitlab "deployment" consisting of the services Gitlab, Postgres and Redis. It runs on a Ubuntu host, and is started automatically at system boot by an upstart script:
/root/docker_gitlab/ on host):
The upstart script
/etc/init/ on host):
description "gitlab service runner"
start on filesystem and started docker
stop on runlevel [!2345]
# Wait for docker to finish starting up first.
while [ ! -e $FILE ] ; do
inotifywait -t 2 -e create $(dirname $FILE)
Fig seems to have been so "docker-style", that the docker team incorporated it as docker-compose. So all should be fine in that regard...