feat(code-server): join the Docker socket's group at startup and add build tools

Add an entrypoint wrapper that reads the socket's GID, adds coder to a
matching group and re-execs the image's entrypoint under it, so docker
works without sudo on any host. Install build-essential and the headers
rbenv needs to build Ruby, and make zsh the login shell. Document home
installs for rbenv, Docker Compose and Buildx plugins, and jq.
This commit is contained in:
tiennm99 committed 2026-10-06 12:23:22 +07:00
1 parent 56b1c5f931
commit 4c37d45377
3 files changed
+115 -12

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
set -eu
# Add coder to the group that owns the mounted Docker socket, then restart
# under that group.
if [ -S /var/run/docker.sock ]; then
gid=$(stat -c %g /var/run/docker.sock)
if ! id -G | tr ' ' '\n' | grep -qx "$gid"; then
group=$(getent group "$gid" | cut -d: -f1)
if [ -z "$group" ]; then
group=docker-host
sudo groupadd -g "$gid" "$group"
fi
sudo usermod -aG "$group" coder
exec sudo -E setpriv --reuid=coder --regid=coder --init-groups \
env PATH="$PATH" USER=coder /usr/bin/entrypoint.sh "$@"
fi
fi
# Start the image's own entrypoint.
exec /usr/bin/entrypoint.sh "$@"