4 Commits

Author SHA1 Message Date
Kelson
2308b02504 Merge pull request #787 from kiwix/better-deal-with-data-dir-permissions
Better deal with container /data dir permissions
2025-12-01 10:51:36 +01:00
rgaudin
81d9a6cc02 Use explicit UID/GID and show them in error message 2025-12-01 09:38:29 +00:00
Emmanuel Engelhart
0232f0a95f Check if /data is writable 2025-11-30 17:48:40 +01:00
Emmanuel Engelhart
309d4d01f1 /data per default writable 2025-11-30 17:48:40 +01:00
2 changed files with 10 additions and 1 deletions

View File

@@ -10,7 +10,8 @@ VOLUME /data
WORKDIR /data
# running as a named unprivileged user
RUN addgroup -S user && adduser -S user -G user
RUN addgroup -S -g 1001 user && adduser -S -u 1001 user -G user
RUN chown user:user /data
USER user
COPY ./start.sh /usr/local/bin/

View File

@@ -3,6 +3,14 @@
# Download if necessary a file
if [ ! -z "$DOWNLOAD" ]
then
# Check if /data is writable
if [ ! -w /data ]
then
echo "'/data' directory is not writable by '$(id -n -u):$(id -n -g)' ($(id -u):$(id -g)). ZIM file(s) can not be written."
exit 1
fi
# Dwonload ZIM file
ZIM=`basename $DOWNLOAD`
wget $DOWNLOAD -O "$ZIM"