Docker compose with changed datadir?

Hello,

I cannot for my life figure it out how to change the default datadir to another harddrive.

Im using Docker desktop WSL2 on windows server 2022 and starting/installing nextcloud AIO with docker-compose.

Could someone please help me with some steps that they know 100% works, maybe share your docker-compose that is working?

I have used Google, Nextcloud docs and Chatgpt and it does not work, i can get the installation running, its working just fine, its just that the datadir does not change.

The directory that i want all users saved data to be located in E:\Duplicated\Nextcloud\

Thank you!

Hi, see GitHub - nextcloud/all-in-one: 📦 The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Thanks for the reply.
I have already checked the docs and i could not figure that one out.

But i followed someone else on the internet and this is how i got it to work with my E: drive instead of default.

Create 2 volumes by starting CMD and pasting the whole code snippet at once.

Datadir volume

docker volume create ^
--driver local ^
--name nextcloud_aio_nextcloud_datadir ^
-o device="/host_mnt/e/Duplicated/Nextcloud/Data" ^
-o type="none" ^
-o o="bind"

Backup volume

docker volume create ^
--driver local ^
--name nextcloud_aio_backupdir ^
-o device="/host_mnt/e/Duplicated/Nextcloud/Backup" ^
-o type="none" ^
-o o="bind"

Then there is the compose file.

services:
  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:
      - NEXTCLOUD_DATADIR=nextcloud_aio_nextcloud_datadir
      - SKIP_DOMAIN_VALIDATION=false
      - APACHE_PORT=11000 # Is needed 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
      - APACHE_IP_BINDING=0.0.0.0 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      - NEXTCLOUD_UPLOAD_LIMIT=100G # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-upload-limit-for-nextcloud
      - NEXTCLOUD_MAX_TIME=3000 # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-max-execution-time-for-nextcloud
      - NEXTCLOUD_MEMORY_LIMIT=2048M # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-memory-limit-for-nextcloud
volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer

When i did this, everything is working just fine. All users data is now saved on another disk.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.