如何在马拉松比赛中使用体积 [英] How to use volumes-from in marathon
问题描述
我与mesos +马拉松+ docker合作已经有一段时间了,但有时我陷入了困境.目前,我尝试处理持久性容器,并尝试使用"volumes-from"参数,但由于无法识别如何确定要放入的数据框的名称,因此无法正常工作它作为json中的键.我在此处
I'm working with mesos + marathon + docker quite a while but I got stuck at some point. At the moment I try to deal with persistent container and I tried to play around with the "volumes-from" parameter but I can't make it work because I have no clue how I can figure out the name of the data box to put it as a key in the json. I tried it with the example from here
{
"id": "privileged-job",
"container": {
"docker": {
"image": "mesosphere/inky"
"privileged": true,
"parameters": [
{ "key": "hostname", "value": "a.corp.org" },
{ "key": "volumes-from", "value": "another-container" },
{ "key": "lxc-conf", "value": "..." }
]
},
"type": "DOCKER",
"volumes": []
},
"args": ["hello"],
"cpus": 0.2,
"mem": 32.0,
"instances": 1
}
我真的很感谢任何帮助:-)
I would really appreciate any kind of help :-)
推荐答案
据我所知:
docker --volume-from
接受容器的ID或名称.
From what I know :
docker --volume-from
take the ID or the name of a container.
由于您的数据容器也是与Marathon一起启动的,因此它会获得一个ID(而不是如何从Marathon中获取此ID)和该形式的名称:mesos-0fb2e432-7330-4bfe-bbce-4f77cf382bb4
,它与Mesos中的任务ID或Docker ID不相关.
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.
解决方案是为您的web-ubuntu应用程序编写如下内容:
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" }
]
由于该docker-ID在Marathon中是未知的,因此使用以Marathon开始的datacontainer是不切实际的.
Since this docker-ID is unknown from Marathon it is not practical to use datacontainer that are started with Marathon.
您可以尝试直接使用Docker启动数据容器(不使用Marathon),并像以前一样使用它,但是由于您事先不知道web-ubuntu
的调度位置(除非您添加了强制它的约束) )不切实际.
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.
这篇关于如何在马拉松比赛中使用体积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!