From 9b4ed6b21c00b9f96eeadc7d209c2fee5138ca02 Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 4 Oct 2017 13:04:15 +0200 Subject: [PATCH] [PHP-FPM] Include Docker api for better SOGo status handling and future changes --- data/Dockerfiles/phpfpm/docker-entrypoint.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/Dockerfiles/phpfpm/docker-entrypoint.sh b/data/Dockerfiles/phpfpm/docker-entrypoint.sh index 8c986335..65e33424 100755 --- a/data/Dockerfiles/phpfpm/docker-entrypoint.sh +++ b/data/Dockerfiles/phpfpm/docker-entrypoint.sh @@ -82,4 +82,16 @@ if [[ ! -z ${DOMAIN_ARRAY} ]]; then done fi +# Socket access +DOCKER_SOCKET=/var/run/docker.sock +DOCKER_GROUP=docker +REGULAR_USER=www-data + +if [ -S ${DOCKER_SOCKET} ]; then + DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET}) + delgroup $(stat -c '%G' ${DOCKER_SOCKET}) + addgroup -g ${DOCKER_GID} ${DOCKER_GROUP} + adduser ${REGULAR_USER} ${DOCKER_GROUP} +fi + exec "$@"