Automatically start docker container's linked dependencies

You might even want to look into the 'official' Fig project, which has now been replaced by Docker Compose. It should be fairly easy to configure / setup.

Your use case of running gitlab is basically the same as the Fig - Wordpress example or by using the gitlab-compose script

And if you're working on a Mac, you might want to have a look at the Docker toolbox which includes Compose, but also various other tools for getting up and running quickly!


I think you can look at Decking

Also you can manage dependencies in a way CoreOS does it. By writing a Unit file for your main gitlab container like:

[Unit]
...
Requires=docker.service
Requires=redis.service
Requires=mysql.service
...
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill gitlab
ExecStartPre=-/usr/bin/docker rm gitlab
ExecStart=/usr/bin/docker run --name gitlab gitlab
ExecStop=/usr/bin/docker stop gitlab

Where mysql.serice is Unit file for MySQL container, redis.service a Redis one, etc.