Erik Osterman (Cloud Posse)
01/03/2022, 4:08 AMMike Crowe
01/29/2022, 2:14 PMif [ "${OS}" == 'Linux' ]; then
DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
fi
This works ok, but you can't sudo. I next have tested:
if [ "${OS}" == 'Linux' ]; then
DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
DOCKER_ARGS+=(--volume="/etc/group:/etc/group" --volume="/etc/passwd:/etc/passwd" --volume="/etc/shadow:/etc/shadow")
fi
which also works, but it borks your groups in the docker container. You can sudo properly, but the system isn't quite right.
@rb may be onto a better method, which would look like the following:
• Update the docker image to run as a user with sudo privileges for everybody. I know this is a process change, but I think it's actually a good idea:
Dockerfile:
RUN \
groupadd -g 1000 geouser && \
useradd -d /conf -G sudo -g geouser -u 1000 geouser && \
sed -i 's/sudo[[:space:]]ALL=(ALL:ALL) ALL/sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
RUN chown -R 1000:1000 /conf /usr/local/bin /home /var/tmp
• Update for Linux (and Darwin, IMO -- please jump in if you disagree)
templates/wrapper:
if [ "${OS}" == 'Linux' ]; then
DOCKER_ARGS+=(--user="$(id -u):$(id -g)")
fi
• We would need to update the Documentation website to show the run line of:
docker run -it --rm --user="$(id -u):$(id -g)" --volume $HOME:/localhost cloudposse/geodesic:latest-debian --login
I think this will be pretty universal, though we may need to add a notation to remove that for WSL? I haven't used WSL in ages, so I'm not sure if it supports id -uJeremy (UnderGrid Network Services)
01/29/2022, 4:29 PMid -u and id -g work fine under WSL2.
This is, from what I've gathered, much different with WSL2 than originally as WSL2 has an virtual hard drive image and the Windows drives are mounted under /mnt/<drive letter> by default though this mountpoint could be changed in the /etc/wsl.conf if it is created inside the WSL guest itself. The initial user that is created for inside WSL does use UID:GID 1000:1000.Jeremy (UnderGrid Network Services)
01/29/2022, 4:41 PMWSL_DISTRO_NAME env variable. The HOME env variable does point to the user home directory under WSL not Windows. The Windows mount points are all of type 9p not drvfs as the templates/wrapper currently looks for. While uname -r will include Microsoft if you use case-insensitive matching (ie- 5.10.60.1-microsoft-standard-WSL2) that elif block doesn't seem to be reached when running under WSL2. Nor does the templates/wrapper account for situations where the Windows User home directories are on a drive other than C:\Users as in my case where it is actually H:\Users .Jeremy G (Cloud Posse)
02/02/2022, 6:18 AMJeremy G (Cloud Posse)
02/03/2022, 7:00 PMJeremy G (Cloud Posse)
02/04/2022, 6:06 AMsudo geodesic, the geodesic wrapper does not get the user's UID and GID or home directory, so BindFS does not help and we do not get the right home directory mapped to /localhost anyway.
How are you launching Geodesic? Are you able to find the non-root user's UID, GID, and $HOME?