How to use volumes-from in marathon How to use volumes-from in marathon docker docker

How to use volumes-from in marathon


From what I know : docker --volume-from take the ID or the name of a container.

Since your datacontainer is launch with Marathon too, it get an ID (not sur how to get this ID from marathon) and a name of that form : mesos-0fb2e432-7330-4bfe-bbce-4f77cf382bb4 which is not related to task ID in Mesos nor docker ID.

The solution would be to write something like this for your web-ubuntu application :

"parameters": [    { "key": "volumes-from", "value": "mesos-0fb2e432-7330-4bfe-bbce-4f77cf382bb4" }]

Since this docker-ID is unknown from Marathon it is not practical to use datacontainer that are started with Marathon.

You can try to start a datacontainer directly with Docker (without using Marathon) and use it as you do before but since you don't know in advance where web-ubuntu will be scheduled (unless you add a constraint to force it) it is not practical.


{    "id": "data-container",    "container": {        "docker": {            "image": "mesosphere/inky"        },        "type": "DOCKER",        "volumes": [      {        "containerPath": "/data",        "hostPath": "/var/data/a",        "mode": "RW"      }    ]    },    "args": ["data-only"],    "cpus": 0.2,    "mem": 32.0,    "instances": 1}{    "id": "privileged-job",    "container": {        "docker": {            "image": "mesosphere/inky"            "privileged": true,            "parameters": [                { "key": "hostname", "value": "a.corp.org" },                { "key": "volumes-from", "value": "data-container" },                { "key": "lxc-conf", "value": "..." }            ]        },        "type": "DOCKER",        "volumes": []    },    "args": ["hello"],    "cpus": 0.2,    "mem": 32.0,    "instances": 1}