version: '2'
services:
  zookeeper:
    image: jplock/zookeeper:3.4.5
    hostname: zookeeper

  mesosmaster:
    image: mesosphere/mesos-master:1.0.0-rc1
    hostname: mesosmaster
    command: /mesos/build/bin/mesos-master.sh
    environment:
      - MESOS_QUORUM=1
      - MESOS_WORK_DIR=/var/lib/mesos
      - MESOS_LOG_DIR=/var/log
      - MESOS_ZK=zk://zookeeper:2181/mesos
      - MESOS_ROLES=public
    ports:
      - "5050:5050"
    links:
      - zookeeper

  client:
    build: .
    privileged: true
    links:
      - mesosmaster
      - etcd
    environment:
      - MESOS_MASTER=zk://fake_addr
    volumes:
      - /lib/modules:/lib/modules
    dns:
    - 192.168.255.254

  agent:
    build: .
    privileged: true
    links:
      - mesosmaster
      - zookeeper
      - etcd
    environment:
      - MESOS_MASTER=zk://zookeeper:2181/mesos
      - MESOS_EXECUTOR_REGISTRATION_TIMEOUT=5mins
      - MESOS_WORK_DIR=/var/lib/mesos
      - MESOS_CONTAINERIZERS=mesos,docker
      - MESOS_ISOLATOR=cgroups/cpu,cgroups/mem
      - MESOS_LOG_DIR=/var/log
      - MESOS_RESOURCES=ports(*):[9000-31100]
      - MESOS_NETWORK_CNI_PLUGINS_DIR=/cni/bin/
      - MESOS_NETWORK_CNI_CONFIG_DIR=/cni/conf/
      - MESOS_ISOLATION=filesystem/linux,docker/runtime
      - MESOS_IMAGE_PROVIDERS=docker
    volumes:
      - /lib/modules:/lib/modules
    dns:
    - 192.168.255.254

  marathon:
    image: mesosphere/marathon:v1.2.0-RC4
    environment:
      - MARATHON_MASTER=zk://zookeeper:2181/mesos
      - MARATHON_ZK=zk://zookeeper:2181/marathon
      - MARATHON_MAX_TASKS_PER_OFFER=32
    ports:
      - "8080:8080"
    links:
      - mesosmaster
      - zookeeper

  etcd:
    image: quay.io/coreos/etcd:v2.3.5
    environment:
      - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379,http://localhost:2379
    ports:
      - "2379:2379"
