File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,17 @@ set -eu
55# Otherwise the current container UID may not exist in the passwd database.
66eval " $( fixuid -q) "
77
8- USER=" $DOCKER_USER "
8+ if [ " ${DOCKER_USER-} " ]; then
9+ USER=" $DOCKER_USER "
10+ if [ " $DOCKER_USER " != " $( whoami) " ]; then
11+ echo " $DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
12+ # Unfortunately we cannot change $HOME as we cannot move any bind mounts
13+ # nor can we bind mount $HOME into a new home as that requires a privileged container.
14+ sudo usermod --login " $DOCKER_USER " coder
15+ sudo groupmod -n " $DOCKER_USER " coder
916
10- if [ " ${DOCKER_USER-} " ] && [ " $DOCKER_USER " != " $( whoami) " ]; then
11- echo " $DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
12- # Unfortunately we cannot change $HOME as we cannot move any bind mounts
13- # nor can we bind mount $HOME into a new home as that requires a privileged container.
14- sudo usermod --login " $DOCKER_USER " coder
15- sudo groupmod -n " $DOCKER_USER " coder
16-
17- sudo sed -i " /coder/d" /etc/sudoers.d/nopasswd
17+ sudo sed -i " /coder/d" /etc/sudoers.d/nopasswd
18+ fi
1819fi
1920
2021dumb-init /usr/bin/code-server " $@ "
You can’t perform that action at this time.
0 commit comments