HUB
Sign inSign up

verypacific/nextcloud

By verypacific

•Updated 3 days ago

Nextcloud (fpm-alpine) with user modifications (push, inotify, UID/GID changes)

Image
Content management system
0

10K+

verypacific/nextcloud repository overview

⁠Nextcloud with user modifications

⁠UID and GID change

The official nextcloud-fpm-alpine image user www-data defaults to UID:82 and GID:82.
This image adjusts the defaults to more suitable UID:GID values of 1000:1001.
This enables sharing files with other docker services and containers without getting into file permission conflicts.

⁠Runtime UID and GID (PUID / PGID)

Since v3.0.0 the UID and GID of www-data can be changed at container start, without rebuilding the image:

docker cli:

docker run -d --name nextcloud-app \
  -e PUID=500 \
  -e PGID=500 \
  verypacific/nextcloud:<tag>

docker compose:

services:
  nextcloud-app:
    image: verypacific/nextcloud:<tag>
    environment:
      - PUID=500
      - PGID=500
  • Unset variables keep the image defaults (1000:1001). Setting only one of them changes only that ID.
  • Only files inside the image are re-owned. Volumes and bind mounts (/var/www/html, data directory, external storage) are never changed. When switching the IDs of an existing installation, re-own the persistent data on the host yourself (container stopped), e.g. find <path> -uid <old> -gid <old> -exec chown -h <new>:<new> {} +. Do not use a blanket chown -R on folders that also hold database or cache data.
  • The remap requires the container to start as root (default). With user: / --user set, the remap is skipped.
  • PUID=0 / PGID=0 are rejected.
  • Containers that override the entrypoint (e.g. a notify_push sidecar) do not run the remap.

⁠Watch external shares changes (inotify php extension)

To enable watch of external share changes in nextcloud inotify and the php-extension have been added.

⁠supervisord configuration and drop-ins

The image starts supervisord with /supervisord.conf (php-fpm and cron, based on the official Nextcloud example). This file includes all *.ini files from /etc/supervisor.d/, the drop-in directory of Alpine's supervisor package.

The watcher for external storages ships as the drop-in /etc/supervisor.d/watch-external.ini. By default it watches the external storages with IDs 1 and 2. This helps detect and sync changes made outside Nextcloud, e.g. to paperless-ngx consume and document folders.

To get the IDs of your external storages:

docker exec --user www-data nextcloud-app php occ files_external:list
⁠Adjust the watcher (no rebuild required)

Copy the drop-in from the image tag you run, edit it (e.g. numprocs) and bind-mount it over the bundled one:

docker run --rm --entrypoint cat verypacific/nextcloud:<tag> /etc/supervisor.d/watch-external.ini > watch-external.ini
# edit watch-external.ini, e.g. numprocs=3

docker cli:

docker run -d --name nextcloud-app \
  -v /path/to/watch-external.ini:/etc/supervisor.d/watch-external.ini:ro \
  verypacific/nextcloud:<tag>

docker compose:

services:
  nextcloud-app:
    image: verypacific/nextcloud:<tag>
    volumes:
      - /path/to/watch-external.ini:/etc/supervisor.d/watch-external.ini:ro
⁠Add your own programs

Bind-mount additional *.ini files into /etc/supervisor.d/, e.g. -v /path/to/my-job.ini:/etc/supervisor.d/my-job.ini:ro.

  • Programs run as root unless the section sets a user. Add user=www-data for anything that touches Nextcloud files or runs occ.
  • Use a new program name. A drop-in section with an existing name ([program:php-fpm], [program:cron], [program:watch_external]) silently replaces the bundled program.
⁠Disable the watcher

If you do not use external storages, disable the watcher by mounting an empty file over the drop-in. Otherwise it retries for about 30 minutes and then gives up, filling the log with errors.

-v /dev/null:/etc/supervisor.d/watch-external.ini:ro
⁠Notes
  • Configuration is read once at container start. Apply changes with docker restart nextcloud-app.
  • A syntax error in a drop-in prevents supervisord and therefore the container from starting. Check docker logs nextcloud-app after changes.
  • After an image update, compare your copy with the bundled watch-external.ini of the new tag, as improvements to the bundled file are not applied to your copy.
  • numprocs watches consecutive IDs starting at numprocs_start. For non-consecutive IDs add a separate [program:...] section per ID.
  • /supervisord.conf itself should not be replaced. Use drop-ins instead, so that changes to php-fpm and cron in future images still apply.

Setup follows official instructions icewind1991/files_inotify⁠ See as well How to automatically detect new files in external storage⁠


⁠Tagging and Updates

Tags follow those of the official Nextcloud images. Image updates get released as soon as a new official Nextcloud images becomes available time permitting.

Tag summary

Content type

Image

Digest

sha256:9b2b5c7af…

Size

419.5 MB

Last updated

3 days ago

docker pull verypacific/nextcloud