Docker – Automatically start docker container’s linked dependencies

dependenciesdockerstartup

I run gitlab in a docker container and it separates its dependencies (MySQL, Redis, Mailserver) quite nicely into separate docker containers. Running them is not a problem, I start them in reverse order: the dependencies first, than gitlab itself.

From time to time I have to restart the docker host. Currently I ssh into the docker host and manually restart the containers. Is there a better way for it? Like just tell some service to start the gitlab container and it takes care of starting its dependencies first? I know I can create individual init scripts for each docker container, but that's not what I'm looking for.

Best Answer

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!

Related Topic