Managing applications

A Mesos cluster is managed with the dcos tool and the web interface. Applications in Mesos are handled by the Marathon scheduler and are defined in JSON format.

Running a simple application

Let's start with a simple container that runs Nginx. Create a file named nginx.json that contains the following definition:

{ 
  "id" : "simple-nginx", 
  "instances" : 1, 
  "cpus" : 0.25, 
  "mem" : 64.0, 
  "container" : { 
    "type" : "DOCKER", 
    "docker" : { 
      "image" : "nginx:1.11", 
      "network" : "HOST" 
    } 
  } 
} 

The id tag is the name of the service. It is displayed in the service list. The instances tag tells Marathon that only one instance is needed. It can be increased or decreased as needed later.

The cpus and mem tags are hints to Marathon as to what percentage ...

Get Docker Orchestration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.