Qian Zhang commented on MESOS-6340:

I think our solution can be: If user does not set {{HOME}} explicitly, set it 
to {{$MESOS_SANDBOX}} which is the value of agent's flag 
{{--sandbox_directory}} for the container with image specified or the path to 
the container sandbox on the agent host filesystem for the container without 
image specified.

The reason that I do not suggest to get user's home directory from /etc/passwd 
in the container image is, in Mesos containerizer, we always launch container 
with the user on the agent host rather than the user in the container image 
which is different from Docker. However this seems another area in Mesos 
containerizer that we can improve: For the container with image specified, we 
should change to use the user in the image to launch the container. [~jieyu] 
and [~gilbert], how do you think?

> Set HOME for Mesos tasks
> ------------------------
>                 Key: MESOS-6340
>                 URL: https://issues.apache.org/jira/browse/MESOS-6340
>             Project: Mesos
>          Issue Type: Bug
>          Components: agent, containerization
>            Reporter: Cody Maloney
>            Priority: Major
>              Labels: containerizer
> Quite a few programs assume {{$HOME}} points to a user-editable data file 
> directory.
> One example is PYTHON, which tries to look up $HOME to find user-installed 
> pacakges, and if that fails it tries to look up the user in the passwd 
> database which often goes badly (The container is running under the `nobody` 
> user):
> {code}
>     if i == 1:
>         if 'HOME' not in os.environ:
>             import pwd
>             userhome = pwd.getpwuid(os.getuid()).pw_dir
>         else:
>             userhome = os.environ['HOME']
> {code}
> Just setting HOME by default to WORK_DIR would enable more software to work 
> correctly out of the box. Software which needs to specialize / change it (or 
> schedulers with specific preferences), should still be able to set it 
> arbitrarily and anything a scheduler explicitly sets should overwrite the 
> default value of $WORK_DIR

This message was sent by Atlassian JIRA

Reply via email to