Skip to content

Passing 'Docker Run' Options to Mesos/Marathon/Chronos #859

@alanhughes

Description

@alanhughes

I am trying to run my containers in mesos and outputting all logs to Cloudwatch. According to Docker documentation, I should pass the following to 'docker run':

--log-driver=awslogs --log-opt awslogs-region=us-east-1 --log-opt awslogs-group=myLogGroup
(from https://docs.docker.com/engine/admin/logging/awslogs/#awslogs-region)

to docker run. In order to achieve this using Marathon (or Chronos, I assume?) , I should add the following block to my configuration json file for my task


            "parameters": [
            { "key": "hostname", "value": "a.corp.org" },
            { "key": "volumes-from", "value": "another-container" },
            { "key": "lxc-conf", "value": "..." }
        ]

https://mesosphere.github.io/marathon/docs/native-docker.html

It appears that this config appends the following to your docker run

--{key}={value}
Since I need to do something of the form "--log-opt awslogs-region=us-east-1", I am putting "key": "log-opt awslogs-region", "value": "us-east-1", which generates the docker run command correctly, as I can see from stderr in mesos. However, I then get an error saying

See 'docker run --help'.```
Running the generated docker run command from stderr directly on the mesos slave works fine.

```# java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)```

Mesos Version: 1.1.0

Chronos container: mesosphere/chronos:v3.0.1

java -jar /chronos/chronos.jar --master zk://xx.xx.xx.xx:2181/mesos --zk_hosts zk://xx.xx.xx.xx:2181 --cluster_name aws --hostname XXXXXXXX --mail_server XXXXXXXX --mail_user XXXXXXXX --mail_passwordXXXXXXXX --mail_from XXXXXXXX --http_port XXXXXXXX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions