Docker Engine

Launching Docker containers from Docker images

Docker Engine launches Docker containers from Docker images. Use the Docker Engine if you need the features of the Docker Engine.

If you aren’t using features that are specific to the Docker engine, you should consider using the DC/OS Universal Container Runtime. The DC/OS Universal Container Runtime provides features such as support for GPU resources that are not available for Docker containers.

Provision a container with the Docker Engine

  • The default entry point is the launch command for the container. If the entry point accepts arguments, you can specify them in the args field of the Marathon app definition. If there is no default entry point, you must specify a command in the cmd field. It is invalid to supply both cmd and args for the same app.
  • When you run a Docker image in the Docker Engine, the underlying Docker log files are not truncated or rotated. These files can become arbitrarily large (and often go to a system disk rather than a storage disk). This can cause a server with limited disk space to run out of disk space. Mesosphere recommends that you disable Docker logging if you are using Docker Engine. To do this, set the log-driver parameter to none in the containers.docker.parameters field of your app definition. If you are provisioning the container using the DC/OS UI:
    1. Click the JSON EDITOR toggle button.

      json editor

      Figure 1. JSON Editor toggle button

    2. Enter the parameters field in the JSON configuration.

DC/OS UI

  1. Click the Services tab of the DC/OS UI, then click RUN A SERVICE.

  2. Click Single Container.

  3. Enter the service ID.

  4. In the CONTAINER IMAGE field, enter a container image.

  5. Click MORE SETTINGS. In the Container Runtime section, choose the DOCKER ENGINE radio button.

  6. Click REVIEW & RUN and RUN SERVICE.

DC/OS CLI

In your Marathon application definition, set the container.type parameter to DOCKER.

{  
   "id":"<my-service>",
   "container":{  
      "type":"DOCKER",
      "docker":{
         "image":"<my-image>",
         "parameters": [
           {
             "key": "log-driver",
             "value": "none"
           }
         ]
      }
   },
   "args":[  
      "<my-arg>"
   ]
}

For examples, see Deploying a Docker-based Service.

Further Reading