lifecycle: fix worker startup error when docker socket's group is not called docker

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-09 15:24:35 +02:00
parent 6cbba45291
commit 0e30b6ee55
1 changed files with 4 additions and 1 deletions

View File

@ -14,9 +14,12 @@ function check_if_root {
# Get group ID of the docker socket, so we can create a matching group and # Get group ID of the docker socket, so we can create a matching group and
# add ourselves to it # add ourselves to it
DOCKER_GID=$(stat -c '%g' $SOCKET) DOCKER_GID=$(stat -c '%g' $SOCKET)
# Ensure group for the id exists
getent group $DOCKER_GID || groupadd -f -g $DOCKER_GID docker getent group $DOCKER_GID || groupadd -f -g $DOCKER_GID docker
usermod -a -G $DOCKER_GID authentik usermod -a -G $DOCKER_GID authentik
GROUP="authentik:docker" # since the name of the group might not be docker, we need to lookup the group id
GROUP_NAME=$(getent group $DOCKER_GID | sed 's/:/\n/g' | head -1)
GROUP="authentik:${GROUP_NAME}"
fi fi
# Fix permissions of backups and media # Fix permissions of backups and media
chown -R authentik:authentik /media /backups chown -R authentik:authentik /media /backups