Launching a Docker container
In this recipe, you will learn how to launch a Docker container using the Marathon API. Marathon, as with most Mesos frameworks, is able to run Docker containers. This is extremely useful in a private PaaS because developers are able to ship their machines into production with one simple click without worrying about server configuration or asking admins for help.
Getting ready
Before you start, ensure Marathon is up and running and Mesos has enabled Docker support. You can find more information in Chapter 5, Managing Containers.
How to do it...
The operation is similar to running a command. The main difference is that we need to pass the Docker image description and its configuration such as ports, variables, and optional Docker parameters. Remember to enable Docker support on Mesos agents before proceeding.
The application definition could look as follows:
{ "id": "/web/server", "cpus": 1.0, "mem": 64, "disk": 0, "instances": 1, "container": { "type...