I guess the mention in the documentation to “manually” creating the volume would be the key. Well at least it’s a documented bug in Nextcloud AIO, right?
It’s not a bug in AIO. It’s the way Docker Compose works.
When defining the nextcloud_aio_nextcloud_datadir volume via Compose, Docker won’t create the volume until it is associated with a service. You can verify this yourself: it won’t even show up in docker compose config for example.
This is why the AIO instructions say to create the volume beforehand manually. This works around this limitation in Docker.
Without getting into all the specifics at the moment, there is a workaround even for Compose: you can create a dummy service in the Compose file that is associated with the nextcloud_aio_nextcloud_datadir. You won’t use that service for anything, but it’s enough for Compose not to consider the volume orphaned – so it creates the volume.
volumes: # If you want to store the data on a different drive, see https://github.com/nextcloud/all-in-one#how-to-store-the-filesinstallation-on-a-separate-drive
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work
nextcloud_aio_nextcloud_datadir:
name: nextcloud_aio_nextcloud_datadir
driver: local
driver_opts:
type: "nfs"
o: "addr=192.168.5.23,nfsvers=4,rw,soft,nolock"
device: ":/"
services:
# This service does nothing but keep the volume "alive" in Compose's eyes
nfs-volume-anchor:
image: alpine
command: "true"
volumes:
- nextcloud_aio_nextcloud_datadir:/data
nextcloud-aio-mastercontainer:
image: nextcloud/all-in-one:latest
nextcloud-aio-mastercontainer:
image: nextcloud/all-in-one:latest
init: true
restart: always
container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
- /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
ports:
- 80:80 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
- 8080:8080
- 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
environment: # Is needed when using any of the options below
NEXTCLOUD_DATADIR: nextcloud_aio_nextcloud_datadir # Allows to set the host directory for Nextcloud's datadir. ⚠️⚠️⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done! See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
Take a look at the parsed config output: docker compose config (for your existing Compose file). If the NFS volume isn’t listed there, this is at least part of the problem. Then do the same for the example above. That NFS volume will show up.
As far as I understand that is how it is supposed to work with docker compose. And it actually did with all previous projects I configured. So why is it not working with Nextcloud AIO?
Did those projects have all the services (i.e. the ones reference the NFS volumes) in the Compose perhaps?
AIO doesn’t work like that; it bootstraps via the mastercontainer then interacts with the Docker API directly to bring up and manage additional containers to bring up a full Nextcloud stack.
I only posted the volumes part of the compose file because that’s the only relevant part. Together with my question it’s obvious that the volume is actually created and used. Just my additional volume settings are ignored.
Believe it or not the people here do have some idea what they’re doing. We don’t just ask for additional information for the heck of it. The rest of the Compose file does matter.