Search code examples
jsondockerhostsmesosmarathon

--add-host parameter in Marathon docker application


I have docker images (with entrypoints) that I would like to run using Mesos and Marathon. These images require changes in /etc/hosts and /etc/resolv.conf. When I typically run this I would do something like:

docker run --add-host host:ip --dns-search url image

but in a marathon application (which i'm setting up as a json body to be sent to marathon), I have no idea what these options would be mapped to. For instance -p becomes portMappings in the json body. Does anybody know what the --add-host and --dns-search and potentially other options would become?


Solution

  • You may pass them in parameters like that:

    "container": {
        "type": "DOCKER",
        "docker": {
            "network": "HOST",
            "image": "your/image",
            "parameters": [
                { "key": "add-host", "value": "host:ip" },
                { "key": "dns-search", "value": "url" }
            ]
        }
    }
    

    Refer here, "Privileged Mode and Arbitrary Docker Options" section for details.