Fix monad-impersonate for OS X
Docker on OS X uses a Linux host for the containers, 99% of the time it's the boot2docker image. The user and group within the image (and their IDs) is different from that of the OS X user. However, the Linux host machine also has the OS X host /Users folder mounted (using a VirtualBox share). Given the permissions of the Linux user inside the container, the OS X user's folders are writable.
This commit is contained in:
parent
f1d1786ee3
commit
79950a0545
|
@ -40,8 +40,15 @@ monad-impersonate()
|
|||
local CUSER=$(id -un)
|
||||
local CGID=$(id -g)
|
||||
local CGROUP=$(id -gn)
|
||||
# default docker-machine VM does not change
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
CUID=1000
|
||||
CUSER=docker
|
||||
CGID=50
|
||||
CGROUP=staff
|
||||
fi
|
||||
echo \
|
||||
groupadd -g $CGID $CGROUP '&&' \
|
||||
groupadd -o -f -g $CGID $CGROUP '&&' \
|
||||
useradd -u $CUID -g $CGID -d /opt $CUSER '&&' \
|
||||
sudo --set-home -u $CUSER -g $CGROUP --
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue