Skip to content

Commit f8ddc3f

Browse files
authored
Merge pull request #1171 from felixbuenemann/fix-modifying-docker-socket-gid
fix(boot): Don't change group ownership of docker socket
2 parents 0aec26a + d014017 commit f8ddc3f

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

rootfs/bin/boot

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ python --version
1616
mkdir -p /app/data/logs
1717
chmod -R 777 /app/data/logs
1818

19-
# HACK(bacongobbler): explicitly add the docker socket to the deis group
20-
chgrp deis /var/run/docker.sock
21-
22-
# allow deis user group permission to Docker socket
23-
groupadd -g "$(stat -c "%g" /var/run/docker.sock)" docker || true
24-
usermod -a -G docker deis || true
19+
# modify deis user groups to grant access to Docker socket
20+
DOCKER_SOCKET_GID=$(stat -c "%g" /var/run/docker.sock)
21+
DOCKER_SOCKET_GROUP=$(getent group "$DOCKER_SOCKET_GID" | cut -d : -f 1 || :)
22+
if [[ -z "$DOCKER_SOCKET_GROUP" ]]; then
23+
DOCKER_SOCKET_GROUP=docker
24+
groupadd -g "$DOCKER_SOCKET_GID" "$DOCKER_SOCKET_GROUP"
25+
fi
26+
if [[ "$DOCKER_SOCKET_GROUP" != "deis" ]]; then
27+
usermod -a -G "$DOCKER_SOCKET_GROUP" deis
28+
fi
2529

2630
echo ""
2731
echo "Django checks:"

0 commit comments

Comments
 (0)