Deploy a Mesos Cluster Using Docker

his tutorial will show you how to bring up a single node Mesos cluster all provisioned out using Docker containers (a future post will show how to easily scale this out to multi nodes or see the update on the bottom). This means that you can startup an entire cluster with 7 commands! Nothing to install except for starting out with a working Docker server.

This will startup 4 containers:

  1. ZooKeeper
  2. Meso Master
  3. Marathon
  4. Mesos Slave Container

As mentioned the only prerequisite is to have a working Docker server. This means you can bring up a local Vagrant box with Docker installed, use Boot2Docker, use CoreOS, instance on AWS, or however you like to get a Docker server.

The entire process is outlined in this Github repository: https://github.com/sekka1/mesosphere-docker

All of the Docker container build files used are there also. You can build each container locally or just use the pre-built containers located on the Docker Hub. The commands below will automatically download the needed pre-built containers for you.

ZooKeeper: https://registry.hub.docker.com/u/garland/zookeeper/

Meso Master: https://registry.hub.docker.com/u/garland/mesosphere-docker-mesos-master/

Marathon:  https://registry.hub.docker.com/u/garland/mesosphere-docker-marathon/

Lets Get Started

Step 1: Get the IP of the Docker server and export it out to the environment. We will use this IP over and over again in subsequent Docker commands.

Just as a note, this is the IP address of the server and not docker0 or an IP address inside a Docker container. If you ssh into your server and run the command “ifconfig” use the eth0 interface’s address.

Step 2: Start the ZooKeeper container.

Step 3: Start Mesos Master

Step 4: Start Marathon

Step 5: Start Mesos Slave in a container

Step 6: Goto the Mesos’ webpage

Depending on how you brought up your Docker server and it’s IP address you might have to change the IP you point your browser to but the port will be the same.

The Mesos webpage will be at this address:

Then you should get a page like this but probably at first without all the items in the “Tasks” tables.

Step 7: Goto Marathon’s webpage to start a job

The Marathon webpage lets you schedule long running tasks onto the Meso Slave container. This is a good test to see if your cluster is up and running. You can view the Marathon’s webpage at:

Clicking on the “New App” button on the top right gives you the following menu where you can create a new job/task. We are simply going to echo out hello to a file. We can go into the container and check if the file is created and if the job is continuously running.

Step 8: Check if job/task is running

Lets check if the job/task is continuously running on the Mesos Slave.

On the Docker server run the following commands. It will place you inside the slave container and from there tail out the output.txt file.

You will see “hello” being placed into this file about once a second.

Update: I just updated this projects doc to include how to setup a multi node environment: https://github.com/sekka1/mesosphere-docker#multi-node-setup

Here is the same article but translated to Chinese: http://dockerone.com/article/136

From medium gargar454

Related Articles

comments powered by Disqus