Question

How to manage multiple docker containers

  • Posted February 3, 2015

I wanted to install multiple independent Wordpress instances on a single server. I’m planning on doing this using multiple docker containers. I can do this following the tutorials.

My question is related to the management: after a while it gets messy to see how many contains are running, which Wordpress instance is up or not, … Is there any way to get a proper (web alike) overview where you could get a ‘management’ overview of what’s going on?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thanks for the useful answer. Would you then for each container use a different port number for the external world, like:

  • docker run -p 8001:80 --name “example1.com” tutum/wordpress
  • docker run -p 8002:80 --name “example2.com” tutum/wordpress

so that my webpages are accessible through:

Or can it also work as follows

  • docker run -p 80:80 --name “example1.com” tutum/wordpress
  • docker run -p 80:80 --name “example2.com” tutum/wordpress

There are a number of web interfaces for Docker out there like Rancher.io and Shipyard

Another approach would be to use the native process manager for your host OS. On Ubuntu 14.04, that would be Upstart while on CoreOS it is systemd. This will allow you to start, stop, and check the status of your containers using the native service command

As an example, I created a WordPress container using the tutum/wordpress image and named it “example.com

docker run -p 80:80 --name "example.com" tutum/wordpress

A simple Upstart script to manage a Docker container would look like:

description "Wordpress - example.com"
author "Doker Guru"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
exec /usr/bin/docker start -a example.com
pre-stop exec /usr/bin/docker stop -a example.com

and install it to /etc/init/example.conf The container will now start on boot, respawn if it dies, and you can use commands like:

$ sudo service example status
example stop/waiting
$ sudo service example start
example start/running, process 2900
$ sudo service example stop
example stop/waiting

Once you have multiple containers running multiple services running, this can make your life much easier.