Setting up a docker / fig Mesos environment Setting up a docker / fig Mesos environment docker docker

Setting up a docker / fig Mesos environment


You have not indicated the errors you were experiencing.

This is the documentation for the image you're using:

Mesos base Docker using the Mesosphere packages from https://mesosphere.io/downloads/. Doesn't start Mesos, please use the mesos-master and mesos-slave Dockers.

What really worried me about those images is that they were untrusted and no source was immediately available.

So I re-created your example using the mesosphere github as inspiration:

Updated Example

Example updated to include the chronos framework

├── build.sh├── fig.yml├── mesos│   └── Dockerfile├── mesos-chronos│   └── Dockerfile├── mesos-master│   └── Dockerfile└── mesos-slave    └── Dockerfile

Build the base image (only has to be done once)

./build.sh

Run fig to start an instance of each service:

$ fig up -dCreating mesos_zk_1...Creating mesos_master_1...Creating mesos_slave_1...Creating mesos_chronos_1...

One useful thing about fig is that you can scale up the slaves

$ fig scale slave=5Starting mesos_slave_2...Starting mesos_slave_3...Starting mesos_slave_4...Starting mesos_slave_5...

The mesos master console should show 5 slaves running

http://localhost:15050/#/slaves

And the chronos framework should be running and ready to launch tasks

http://localhost:14400

fig.yml

zk:  image: mesos  command: /usr/share/zookeeper/bin/zkServer.sh start-foregroundmaster:  build: mesos-master  ports:    - "15050:5050"  links:    - "zk:zookeeper"slave:  build: mesos-slave  links:    - "zk:zookeeper"chronos:  build: mesos-chronos  ports:    - "14400:4400"  links:    - "zk:zookeeper"

Notes:

  • Only single instance of zookeeper needed for this example

build.sh

docker build --rm=true --tag=mesos mesos

mesos/Dockerfile

FROM ubuntu:14.04MAINTAINER Mark O'Connor <mark@myspotontheweb.com>RUN echo "deb http://repos.mesosphere.io/ubuntu/ trusty main" > /etc/apt/sources.list.d/mesosphere.listRUN apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BFRUN apt-get -y updateRUN apt-get -y install mesos marathon chronos

mesos-master/Dockerfile

FROM mesosMAINTAINER Mark O'Connor <mark@myspotontheweb.com>EXPOSE 5050CMD ["--zk=zk://zookeeper:2181/mesos", "--work_dir=/var/lib/mesos", "--quorum=1"]ENTRYPOINT ["mesos-master"]

mesos-slave/Dockerfile

FROM mesosMAINTAINER Mark O'Connor <mark@myspotontheweb.com>CMD ["--master=zk://zookeeper:2181/mesos"]ENTRYPOINT ["mesos-slave"]

mesos-chronos/Dockerfile

FROM mesosMAINTAINER Mark O'Connor <mark@myspotontheweb.com>RUN echo "zk://zookeeper:2181/mesos" > /etc/mesos/zkEXPOSE 4400CMD ["chronos"]

Notes:

  • The "chronos" command line is configured using files.