mirror of
https://github.com/nextcloud/docker.git
synced 2025-04-25 12:50:54 +02:00
update directory permissions to be compatible with non-root
This commit updates the directory permissions to be more compatible when
running the image without root f.e. on OpenShift or when specifying it
when running with `docker run --user www-data:root ...`.
It adds detection logic to the entrypoint script as sudo is not always
allowed.
This change in directory permissions was also proposed by the official
documentation, see 22e2530
.
The `chown` before the volume definition is needed to prepare the volume
as it inherits the permissions.
refs https://github.com/nextcloud/docker/issues/107
This commit is contained in:
parent
2220249a20
commit
bd3fc10d7d
15 changed files with 135 additions and 99 deletions
|
@ -43,6 +43,8 @@ RUN set -ex \
|
|||
RUN a2enmod rewrite
|
||||
|
||||
ENV NEXTCLOUD_VERSION %%VERSION%%
|
||||
|
||||
RUN chown -R www-data:root /var/www/html
|
||||
VOLUME /var/www/html
|
||||
|
||||
COPY config/* /usr/src/nextcloud/config/
|
||||
|
@ -59,16 +61,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \
|
|||
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
|
||||
&& rm nextcloud.tar.bz2 \
|
||||
&& rm -rf /usr/src/nextcloud/updater \
|
||||
# https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
|
||||
&& mkdir -p /usr/src/nextcloud/data \
|
||||
&& mkdir -p /usr/src/nextcloud/custom_apps \
|
||||
&& find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \
|
||||
&& find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \
|
||||
&& chown -R root:www-data /usr/src/nextcloud/ \
|
||||
&& chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \
|
||||
&& chown -R www-data:www-data /usr/src/nextcloud/config/ \
|
||||
&& chown -R www-data:www-data /usr/src/nextcloud/data/ \
|
||||
&& chown -R www-data:www-data /usr/src/nextcloud/themes/ \
|
||||
&& chmod +x /usr/src/nextcloud/occ
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue