• Stars
    star
    249
  • Rank 162,987 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 11 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mesos containerizer hooks for Docker

deimos

Deimos is a Docker plugin for Mesos, providing external containerization as described in MESOS-816.

NOTE: Mesos 0.20.0 shipped with built-in Docker support and this project is no longer actively maintained. More info on the Docker in Mesos 0.20.0 docs page.

Installation

For a complete installation walkthrough, see this article.

Deimos can be installed from the Cheeseshop.

pip install deimos

Passing Parameters to Docker

In Mesos, every successful resource offer is ultimately followed up with a TaskInfo that describes the work to be done. Within the TaskInfo is a CommandInfo and within the CommandInfo there is a ContainerInfo (following MESOS-816). The ContainerInfo structure allows specification of an image URL and container options. For example:

{
  container = ContainerInfo {
    image = "docker:///ubuntu"
    options = ["-c", "10240"]
  }
}

Deimos handles image URLs beginning with docker:/// by stripping the prefix and using the remainder as the image name. The container options are passed to docker run when the task is launched. If a // is found in the options list, all the following arguments will be appended to the end of the run command. This is useful when using an image with an entry point defined. For example:

{
  container = ContainerInfo {
    image = "docker:///flynn/slugrunner"
    options = ["//", "start", "web"]
  }
}

If no ContainerInfo is present in a task, Deimos will still containerize it, by using the --default_container_image passed to the slave, or taking a reasonable guess based on the host's distribution and release.

Some options for Docker, like -H, do not apply only to docker run. These options should be set in the Deimos configuration file.

Deimos recognizes Mesos resources that specify ports, CPUs, and memory and translates them to appropriate Docker options.

Passing Parameters through Marathon

Marathon has a REST API to submit JSON-formatted requests to run long-running commands.

From this JSON object, the following keys are used by Deimos:

  • container A nested object with details about what Docker image to run
    • image What Docker image to run, it may have a custom registry but must have a version tag
    • options A list of extra options to add to the Docker invocation
  • cmd What command to run with Docker inside the image. Deimos automatically adds /bin/sh -c to the front
  • env Extra environment variables to pass to the Docker image
  • cpus How many CPU shares to give to the container, can be fractional, gets multiplied by 1024 and added with docker run -c
  • mem How much memory to give to the container, in megabytes
curl -v -X POST http://mesos1.it.corp:8080/v2/apps \
        -H Content-Type:application/json -d '{
    "id": "marketing",
    "container": {
      "image": "docker:///registry.int/marketing:latest",
      "options": ["-v", "/srv:/srv"]
    },
    "cmd": "/webapp/script/start.sh",
    "env": {"VAR":"VALUE"},
    "cpus": 2,
    "mem": 768.0,
    "instances": 2
}'

This turns into a Docker execution line similar to this:

docker run --sig-proxy --rm \
           --cidfile /tmp/deimos/mesos/10330424-95c2-4119-b2a5-df8e1d1eead9/cid \
           -w /tmp/mesos-sandbox \
           -v /tmp/deimos/mesos/10330424-95c2-4119-b2a5-df8e1d1eead9/fs:/tmp/mesos-sandbox \
           -v /srv:/srv -p 31014:3000 \
           -c 2048 -m 768m \
           -e PORT=31014 -e PORT0=31014 -e PORTS=31014 -e VAR=VALUE \
           registry.int/marketing:latest sh -c "/webapp/script/start.sh"

Logging

Deimos logs to the console when run interactively and to syslog when run in the background. You can configure logging explicitly in the Deimos configuration file.

Configuration

There is an example configuration file in example.cfg which documents all the configuration options. The two config sections that are likely to be most important in production are:

  • [docker]: global Docker options (--host)
  • [log]: logging settings

Configuration files are searched in this order:

./deimos.cfg
~/.deimos
/etc/deimos.cfg
/usr/etc/deimos.cfg
/usr/local/etc/deimos.cfg

Only one configuration file -- the first one found -- is loaded. To see what Deimos thinks its configuration is, run deimos config.

The State Directory

Deimos creates a state directory for each container, by default under /tmp/deimos, where it tracks the container's status, start time and PID. File locks are maintained for each container to coordinate invocations of Deimos that start, stop and probe the container.

To clean up state directories belonging to exited containers, invoke Deimos as follows:

deimos state --rm

This task can be run safely from Cron at a regular interval. In the future, Deimos will not require separate invocation of the state subcommand for regular operation.

Configuring Mesos To Use Deimos

Only the slave needs to be configured. Set these options:

--containerizer_path=/usr/local/bin/deimos --isolation=external

The packaged version of Mesos can also load these options from files:

echo /usr/local/bin/deimos    >    /etc/mesos-slave/containerizer_path
echo external                 >    /etc/mesos-slave/isolation

More Repositories

1

minuteman

[Deprecated] A distributed Load Balancer
632
star
2

dcos-vagrant

Local DC/OS cluster provisioning
Shell
541
star
3

cassandra-mesos-deprecated

[DEPRECATED] This project is deprecated. It will be archived on December 1, 2017.
Java
185
star
4

docker-containers

Dockerfiles and assets for building Docker containers
Shell
175
star
5

aws-cli

Containerized AWS CLI on alpine to avoid requiring the aws cli to be installed on CI machines.
Shell
164
star
6

dcos-docker

DEPRECATED - Run DC/OS in Docker containers
Shell
159
star
7

mesos-cli

This project has been deprecated. Please use the DC/OS CLI.
Python
116
star
8

dcos-cassandra-service

DEPRECATED—Open source Apache Cassandra running on DC/OS is now replaced by mesosphere/dcos-commons/frameworks/cassandra. This repository will be deleted at the end of 2017.
Java
116
star
9

dcos-docs

Documentation for DC/OS
HTML
95
star
10

elasticsearch-mesos

Elastic Search on Mesos
Scala
85
star
11

mesos-framework-tutorial

How to create a Mesos Framework in Go
Go
80
star
12

etcd-mesos

self-healing etcd on mesos!
Go
67
star
13

presentations

Slide decks from presentations given around the world.
CSS
67
star
14

iot-demo

IoT - It's the thing you want! And so here's a full-stack demo.
Scala
63
star
15

time-series-demo

A DC/OS time series demo
Scala
62
star
16

terraform-dcos

DC/OS Terraform Installation and Upgrading Scripts
HCL
62
star
17

sssp

S3 Proxy Mesos Framework
Scala
61
star
18

training

Mesosphere Training
Shell
60
star
19

dcos-metrics

The metrics pipeline for DC/OS 1.9-1.11
C++
58
star
20

spartan

[Deprecated] DNS Dispatcher: An RFC5625 Compliant DNS Forwarder
47
star
21

ansible-dcos

[DEPRECATED] Please consider using the Ansible Roles for DC/OS maintained by the Mesosphere SRE team
Python
37
star
22

dcos-gce

Ansible script to install DC/OS on Google Compute Engine
Python
30
star
23

mesos-hydra

MPICH2 Hydra scheduler for Apache Mesos.
Python
29
star
24

packet-terraform

Terraform scripts for packet.net
HCL
28
star
25

tweeter-go

Mini twitter clone - Demo application for DC/OS
Go
28
star
26

dcos-jenkins-dind-agent

Jenkins Docker-in-Docker agent
Shell
27
star
27

dcos-bootstrap

Install DC/OS on AWS using a single command
Python
25
star
28

navstar01

[Deprecated] Navstar orchestrates virtual overlay networks using VXLAN.
21
star
29

open-docs

[DEPRECATED] Documentation for Mesosphere supported open source projects.
HTML
20
star
30

multiverse

Experimental packages not ready to be in mesosphere/universe
Python
19
star
31

k8s-bootcamp

Kubernetes Training Bootcamp
CSS
18
star
32

cassandra-kairosdb-tutorial

GitHub stream data demo using KairosDB with Cassandra
Python
17
star
33

dcos-installer-ui-01

JavaScript
17
star
34

dcos-zeppelin

DCOS Zeppelin package
HTML
16
star
35

telemetry-net

Erlang
14
star
36

tf_dcos_core

A Terraform module to install, upgrade, and modify nodes for DC/OS clusters.
Shell
13
star
37

dcos-signal-01

A passive data forwarding service for telemetry and analytics gathering of DC/OS clusters.
Go
13
star
38

dcos-windows

Microsoft Windows support to DCOS
C++
12
star
39

mesos-slave-dind

Mesos Slave with Docker-in-Docker
Shell
12
star
40

community

DC/OS community content
11
star
41

3dt-01

Go
11
star
42

aws-cfn-bootstrap

Track the progress of DCOS launches on AWS
Python
11
star
43

dcos-kubectl

Command line tooling for Kubernetes on DCOS
Python
10
star
44

dcos-cli-docker

DCOS CLI in a Docker Container
Shell
10
star
45

velocity-training

Velocity NYC 2015 training session
Shell
10
star
46

stellar

Light-weight monitoring for DCOS
Python
9
star
47

dcos-tunnel

Python
8
star
48

mesos-overlay-modules

C++
8
star
49

secure-mesos-workshop

MesosCon 2017 workshop material.
Shell
8
star
50

mockserver

A mockserver that allows you to mock XHR, long-polling XHR, server sent events and websocket connections
TypeScript
8
star
51

kubeaddons-configs

DEPRECATED: konvoy addons (see https://github.com/mesosphere/kubernetes-base-addons instead)
Go
7
star
52

service-net

Discovery and routing for location-agnostic services.
Scala
7
star
53

fuzzlr

go-fuzz on Mesos!
Go
6
star
54

MongoDB-01

MongoDB Framework
Go
6
star
55

dcos-management

[WIP] additional subcommands to DC/OS CLI to manage mesos cluster (maintenance, etc.)
Python
6
star
56

dispatch

Execute scripts on your mesos cluster
Python
6
star
57

mesosphere-shared-reactjs

JavaScript
5
star
58

mesos-client

Wraps Mesos Event Stream API into rxjs Observable.
JavaScript
5
star
59

mesos-buildenv-01

Build environment for Mesos allowing builds of Mesos Modules with the same dependencies
Makefile
5
star
60

dcos-swarm

DCOS Swarm CLI
Python
5
star
61

octarine

Go
5
star
62

oscon-smack-stack

Labs for the SMACK Stack workshop at OSCON 2018
Shell
5
star
63

tutorial-artefacts

This repository is for hosting of additional artefacts from DC/OS tutorials hosted on the dcos.io website
Shell
5
star
64

redir

HTTP redirector of DNS SRV records with configurable load-balancing strategies.
Go
5
star
65

software-architecture

Software Architecture Tutorial
5
star
66

charts

Mesosphere Kubernetes-a-a-S Helm charts repository
Smarty
5
star
67

opstools

A collection of tools for DC/OS operators
4
star
68

oscon-mesos-2014

4
star
69

godep-licenses

Godep dependency license report generation tool
Shell
4
star
70

vny

Velocity New York Tutorial Files
4
star
71

boot2dcos

Shell
4
star
72

presentations-community

Slide decks from presentations by/with community partners
CSS
4
star
73

edge-proxy

nginx based reverse proxy for auth and SSL termination
Shell
3
star
74

hue

Hue ported to DCOS
3
star
75

helloworld

Go
3
star
76

dcos-cli-vpn

Shell
3
star
77

connection-manager

Allows to manage connections inside the browser and order them in a queue by priority.
JavaScript
3
star
78

packaging-docs

Documentation for the DC/OS Packaging Subsystem
Shell
3
star
79

kafka-service

For packaging Kafka and deploying with Ubuntu
Shell
3
star
80

edgelb-kubernetes

Kubernetes controller for Edge-LB for easy L4 (Service) and L7 (Ingress) apps load-balancing.
Go
3
star
81

recordio

Provides a function to read records in the RecordIO format from the input string.
JavaScript
3
star
82

dcos-debugging

Go
3
star
83

nifi-containers

Shell
2
star
84

qcon

2
star
85

hackers-at-berkeley

Example files for H@B workshop.
Python
2
star
86

gists

General Store for all gists in order to allow for easier shared editing.
2
star
87

data-service

The foundation for all data access within DC/OS UI
TypeScript
2
star
88

logstash-pkg

Package Logstash. For great justice.
Shell
2
star
89

dcos-test-utils

DEPRECATED: Please use https://github.com/dcos/dcos-test-utils
2
star
90

http-service

Wraps connections managed by the `@dcos/connection-manager` package into an Observable.
JavaScript
2
star
91

reactjs-mixin-01

JavaScript
2
star
92

dcos-ui-common

JavaScript
2
star
93

weave-guide

Guide for installing Weave onto DC/OS - Experimental
2
star
94

oinker-bot

A simple bot that Oinks
Scala
2
star
95

teamcity-slack-notifier

A python script that when run in TeamCity will post alerts to a Slack Channel
Python
2
star
96

extension-kid

👶 UI tool set for DI powered plugin system
TypeScript
2
star
97

less-color-lighten

A LESS plugin for a simple function that blends a given color with white or black to produce a new color that observes the same general hue as the source color
JavaScript
2
star
98

moxy-docker

2
star
99

connections

Provides different connection types with a unified interface
JavaScript
2
star
100

dcsh

#!/usr/local/bin/dcsh > #!/bin/bash
Python
2
star