File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,17 @@ set -eu
5
5
# Otherwise the current container UID may not exist in the passwd database.
6
6
eval " $( fixuid -q) "
7
7
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
9
16
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
18
19
fi
19
20
20
21
dumb-init /usr/bin/code-server " $@ "
You can’t perform that action at this time.
0 commit comments