From eac1a322ecb54a893934272b308a63cd98f78d7a Mon Sep 17 00:00:00 2001 From: John Stader Date: Wed, 5 Feb 2020 12:44:28 -0500 Subject: [PATCH 1/3] Use environment variable for user and group id I added environment variables for User and Group ID so these can be specified in a docker compose file. This can help resolve permission issues. --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06f9795..61dce2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,10 @@ ARG RCLONE_VERSION="current" ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 ENV S6_KEEP_ENV=1 +# User and Group ID +ENV PUID=911 +ENV GUID=1000 + # install packages RUN \ apk update && \ @@ -45,8 +49,8 @@ RUN \ # create abc user RUN \ - groupmod -g 1000 users && \ - useradd -u 911 -U -d /config -s /bin/false abc && \ + groupmod -g ${GUID} users && \ + useradd -u ${PUID} -U -d /config -s /bin/false abc && \ usermod -G users abc && \ # create some files / folders mkdir -p /config /app /defaults /data && \ From 34f70ec04fe93b36c7d94593a848bac8fa1b7643 Mon Sep 17 00:00:00 2001 From: John Stader Date: Wed, 5 Feb 2020 12:59:26 -0500 Subject: [PATCH 2/3] corrected variable names --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61dce2d..d7868f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV S6_KEEP_ENV=1 # User and Group ID ENV PUID=911 -ENV GUID=1000 +ENV PGID=1000 # install packages RUN \ @@ -49,7 +49,7 @@ RUN \ # create abc user RUN \ - groupmod -g ${GUID} users && \ + groupmod -g ${PGID} users && \ useradd -u ${PUID} -U -d /config -s /bin/false abc && \ usermod -G users abc && \ # create some files / folders From e713c71d6431a3d258fa7e864db4a94fbe5e3ba4 Mon Sep 17 00:00:00 2001 From: John Stader Date: Wed, 5 Feb 2020 13:01:35 -0500 Subject: [PATCH 3/3] Added User and Group id environment variables --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cfba1b1..df1a0a4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ docker create \ * `-e SYNC_DESTINATION_SUBPATH` If the data should be backed up to a subpath on the destionation (will automaticly be created if it does not exist) * `-e CRON_SCHEDULE` A custom cron schedule which will override the default value of: 0 * * * * (hourly) * `-e SYNC_COMMAND` A custom rclone command which will override the default value of: rclone sync /data $SYNC_DESTINATION:/$SYNC_DESTINATION_SUBPATH - +* `-e PUID` User id +* `-e PGID` Group id ## Info