[ 
https://issues.apache.org/jira/browse/MESOS-3413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14900025#comment-14900025
 ] 

haosdent edited comment on MESOS-3413 at 9/21/15 12:49 AM:
-----------------------------------------------------------

[~neunhoef] No sure I understand your ideas correct or not. Let me show how I 
use persistent volumes in docker below.

I need set the volume info correctly in ContainerInfo, so that docker executor 
would mount the persistent volumes. Suppose we have already set up a "path1" 
persistent volume correctly.
{code}
  ContainerInfo::DockerInfo dockerInfo;
  dockerInfo.set_image("busybox");
  Volume* dockerVolume = containerInfo.add_volumes();
  dockerVolume->set_host_path("path1");
  dockerVolume->set_container_path("/path2");
  dockerVolume->set_mode(Volume::RW);
  containerInfo.mutable_docker()->CopyFrom(dockerInfo);
{code}

We could found the docker executor would mount the "path1" to "/path2" in 
docker docker. I got below log from executor stderr file. 
{code}
docker -v 
/tmp/xxxx/slaves/db206124-6d5f-493b-8b72-fdfbf65ed744-S0/frameworks/db206124-6d5f-493b-8b72-fdfbf65ed744-0000/executors/1/runs/88cc5c49-50bd-4bab-9e74-f23c43504906/path1:/path2:rw
 -v 
/tmp/xxxx/slaves/db206124-6d5f-493b-8b72-fdfbf65ed744-S0/frameworks/db206124-6d5f-493b-8b72-fdfbf65ed744-0000/executors/1/runs/88cc5c49-50bd-4bab-9e74-f23c43504906:/mnt/mesos/sandbox
 --net host --entrypoint /bin/sh --name 
mesos-db206124-6d5f-493b-8b72-fdfbf65ed744-S0.88cc5c49-50bd-4bab-9e74-f23c43504906
 busybox -c ls /
{code}

>From executor stdout file, because I run "ls /" command we also could see the 
>/path2 exists.
{code}
total 52
drwxrwxr-x    2 root     root          4096 May 22  2014 bin
drwxr-xr-x    5 root     root           360 Sep 21 00:48 dev
drwxr-xr-x    6 root     root          4096 Sep 21 00:48 etc
drwxrwxr-x    4 root     root          4096 May 22  2014 home
drwxrwxr-x    2 root     root          4096 May 22  2014 lib
lrwxrwxrwx    1 root     root             3 May 22  2014 lib64 -> lib
lrwxrwxrwx    1 root     root            11 May 22  2014 linuxrc -> bin/busybox
drwxrwxr-x    2 root     root          4096 Feb 27  2014 media
drwxrwxr-x    3 root     root          4096 Sep 21 00:48 mnt
drwxrwxr-x    2 root     root          4096 Feb 27  2014 opt
drwxr-xr-x    2 root     root          4096 Sep 21 00:48 path1
dr-xr-xr-x  171 root     root             0 Sep 21 00:48 proc
drwx------    2 root     root          4096 Feb 27  2014 root
lrwxrwxrwx    1 root     root             3 Feb 27  2014 run -> tmp
drwxr-xr-x    2 root     root          4096 May 22  2014 sbin
dr-xr-xr-x   13 root     root             0 Aug 12 09:16 sys
drwxrwxrwt    3 root     root          4096 May 22  2014 tmp
drwxrwxr-x    6 root     root          4096 May 22  2014 usr
drwxrwxr-x    4 root     root          4096 May 22  2014 var
{code}


was (Author: haosd...@gmail.com):
[~neunhoef] No sure I understand your ideas correct or not. Let me show how I 
use persistent volumes in docker below.

I need set the volume info correctly in ContainerInfo, so that docker executor 
would mount the persistent volumes. Suppose we have already set up a "path1" 
persistent volume correctly.
{code}
  ContainerInfo::DockerInfo dockerInfo;
  dockerInfo.set_image("busybox");
  Volume* dockerVolume = containerInfo.add_volumes();
  dockerVolume->set_host_path("path1");
  dockerVolume->set_container_path("/path2");
  dockerVolume->set_mode(Volume::RW);
  containerInfo.mutable_docker()->CopyFrom(dockerInfo);
{code}

We could found the docker executor would mount the "path1" to "/path2" in 
docker docker. I got below log from executor stderr file. 
{code}
docker -v 
/tmp/xxxx/slaves/db206124-6d5f-493b-8b72-fdfbf65ed744-S0/frameworks/db206124-6d5f-493b-8b72-fdfbf65ed744-0000/executors/1/runs/88cc5c49-50bd-4bab-9e74-f23c43504906/path1:/path2:rw
 -v 
/tmp/xxxx/slaves/db206124-6d5f-493b-8b72-fdfbf65ed744-S0/frameworks/db206124-6d5f-493b-8b72-fdfbf65ed744-0000/executors/1/runs/88cc5c49-50bd-4bab-9e74-f23c43504906:/mnt/mesos/sandbox
 --net host --entrypoint /bin/sh --name 
mesos-db206124-6d5f-493b-8b72-fdfbf65ed744-S0.88cc5c49-50bd-4bab-9e74-f23c43504906
 busybox -c ls /
{code}

>From executor stdout file, because I run "ls /" command we also could see the 
>/path2 exists.
{code}
Starting task 1
bin
dev
etc
home
lib
lib64
linuxrc
media
mnt
opt
path2
proc
root
run
sbin
sys
tmp
usr
var
{code}

> Docker containerizer does not symlink persistent volumes into sandbox
> ---------------------------------------------------------------------
>
>                 Key: MESOS-3413
>                 URL: https://issues.apache.org/jira/browse/MESOS-3413
>             Project: Mesos
>          Issue Type: Bug
>          Components: containerization, docker, slave
>    Affects Versions: 0.23.0
>            Reporter: Max Neunhöffer
>            Assignee: haosdent
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> For the ArangoDB framework I am trying to use the persistent primitives. 
> nearly all is working, but I am missing a crucial piece at the end: I have 
> successfully created a persistent disk resource and have set the persistence 
> and volume information in the DiskInfo message. However, I do not see any way 
> to find out what directory on the host the mesos slave has reserved for us. I 
> know it is ${MESOS_SLAVE_WORKDIR}/volumes/roles/<myRole>/<NAME>_<UUID> but we 
> have no way to query this information anywhere. The docker containerizer does 
> not automatically mount this directory into our docker container, or symlinks 
> it into our sandbox. Therefore, I have essentially no access to it. Note that 
> the mesos containerizer (which I cannot use for other reasons) seems to 
> create a symlink in the sandbox to the actual path for the persistent volume. 
> With that, I could mount the volume into our docker container and all would 
> be well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to