Skip to content

Commit a8d8ba9

Browse files
committed
release-image: Remap UID within the image before handling $DOCKER_USER
If do not update the UID within the passwd database to match whatever uid the container is being ran as, then sudo will not work when renaming the user to match $DOCKER_USER as it will complain about the current user being non-existent.
1 parent 7093f99 commit a8d8ba9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ci/release-image/entrypoint.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/sh
22
set -eu
33

4-
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
4+
eval "$(fixuid -q)"
5+
6+
if [ "${DOCKER_USER-}" ]; then
57
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
68
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
79
# nor can we bind mount $HOME into a new home as that requires a privileged container.
@@ -11,7 +13,6 @@ if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
1113
USER="$DOCKER_USER"
1214

1315
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
14-
sudo sed -i "s/coder/$DOCKER_USER/g" /etc/fixuid/config.yml
1516
fi
1617

17-
dumb-init fixuid -q /usr/bin/code-server "$@"
18+
dumb-init /usr/bin/code-server "$@"

0 commit comments

Comments
 (0)