(Last Updated On: August 19, 2018)

In this post, I will show you Mesos Docker container configuration.  This allows you to schedule your own Docker containers on Mesos.

Mesos comes with it’s own container technology which is pretty cool in and of itself but it also has the option to make use of Docker to manage containers. This opens up a lot of possibilites for your mesos cluster.

If you have been following my posts about mesos then you should have a basic mesos cluster configured. This post builds on that post by enabling docker containers.


Since my first article setup mesos on Ubuntu 16.10 this article assumes the same. You can still follow this post if you have a different linux distribution, just find the instructions for installing Docker on your distribution.

Mesos Slave Configuration

All of the configuration performed for this post will be done on the mesos slaves. You will not have to do anything on the master(s).

Install Docker

Our first task will be to install Docker on our mesos slave.

sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb ubuntu-yakkety main'
sudo apt update
sudo apt install -y docker-engine

Since we installed Mesos to use a Systemd service file which runs as the root user, we don’t need to worry about giving other users access to running docker.

Update Mesos SystemD Service

Now we need to update our /etc/systemd/system/mesos-slave.service file to make use of Docker. Add these options to the ExecStartline:

--containerizers=docker,mesos --image_providers=appc,docker --isolation=filesystem/linux,docker/runtime

Your mesos-slave.service file should now look like this:

Description=Mesos Slave Service

ExecStart=/usr/local/sbin/mesos-slave --master=zk://,, --work_dir=/var/lib/mesos --containerizers=docker,mesos --image_providers=appc,docker --isolation=filesystem/linux,docker/runtime


Save the file and exit.

Configure IPTables

Next we need to configure IPTables to allow traffic through the docker0 interface:

iptables -A INPUT -s -i docker0 -p tcp -j ACCEPT

Restart Service

The last step is to restart the slave service.

sudo systemctl daemon-reload
sudo systemctl restart mesos-slave.service

You now have docker enabled as a containerizer for mesos.

Conclusion / Next Steps

To make use of Docker containers you will need to use Marathon, which if you followed my post CONFIGURING A MESOS/MARATHON CLUSTER ON UBUNTU 16.04 you already have! If not then you can follow the Marathon Installation section in that post to get it running. Look for a post soon on how to run a docker container in Marathon.

I hope you enjoyed this post. If it was helpful or if it was way off then please comment and let me know.


I hope you have enjoyed this article, if so please leave a comment below.  For more articles, please signup for the AdminTome Blog below.  Also please feel free to share the article to your friends using the buttons to the left.  Thanks again for reading this post.



Leave a Comment

you're currently offline