Can't mount or use an external HDD as datadir in Windows docker AIO build

I can get the AIO installer to work perfectly on my Windows 10 computer when I donā€™t set the data directory and just use the default, but when I change the data directory to an external hard drive --env NEXTCLOUD_DATADIR="/run/desktop/mnt/host/f/Nextcloud I get this error:

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Configuring Redis as session handler...
Setting php max children...
The initial Nextcloud installation failed.
Please reset AIO properly and try again. For further clues what went wrong, check the logs above.
See https://github.com/nextcloud/all-in-one#how-to-properly-reset-the-instance

Iā€™ve tried mounting the folder into the image by adding the --env NEXTCLOUD_MOUNT="/run/desktop/mnt/host/f/Nextcloud/ and Iā€™ve tried to manually change the ownership using docker exec -it nextcloud-aio-nextcloud chown -R 33:0 /run/desktop/mnt/host/f/Nextcloud/ and docker exec -it nextcloud-aio-nextcloud chmod -R 750 /run/desktop/mnt/host/f/Nextcloud/ but since the nextcloud-aio-nextcloud container was constantly resetting itself, it didnā€™t seem to work. The command I run is shown below and if the --env NEXTCLOUD_DATADIR argument is removed it works totally fine, except that it is storing the datadir on the main SSD, which has very little space.

docker run --init --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 8080:8080 --env APACHE_PORT=11000 --env APACHE_IP_BINDING=0.0.0.0 --env NEXTCLOUD_DATADIR="/run/desktop/mnt/host/f/Nextcloud" --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume //var/run/docker.sock:/var/run/docker.sock:ro nextcloud/all-in-one:latest

Any help or guidance would be appreciated. Iā€™ve tried to mess with it for many hours at this point. Thanks.

Hi, please reset things properly and try again by following GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All-in-One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Oh I forgot to mention, I reset it completely using those directions each time, and Iā€™ve done it so frequently I made a little powershell script that goes like this:

docker stop nextcloud-aio-mastercontainer
docker stop nextcloud-aio-domaincheck
docker container prune
docker network rm nextcloud-aio
docker volume prune --filter all=1
docker image prune -a

since I donā€™t have any other docker images running.

Hmā€¦ Aparrently you always forgot to reset F:\Nextcloud on the host then.

By reset F:\Nextcloud do you mean delete it and remake it? I tried this once before, but just to be sure I just added in the lines

rm -r F:\Nextcloud
mkdir F:\Nextcloud

to the little script and reran it, then reinstalled the docker and I get the same error repeated over and over again:

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Configuring Redis as session handler...
Setting php max children...
The initial Nextcloud installation failed.
Please reset AIO properly and try again. For further clues what went wrong, check the logs above.
See https://github.com/nextcloud/all-in-one#how-to-properly-reset-the-instance

If that works on windows then yes (needs to be deleted on the host.)

Yes that works in windows when run on powershell (which converts a lot of basic linux commands pretty well). I still get the same error about resetting the AIO properly and Iā€™m not sure what to modify or change to get it running on that F:\ drive. If you have any additional recommendations or advice Iā€™d really appreciate it. Thanks.

Is F: a network drive?

No itā€™s attached by USB. I might have tried other folders for the DATADIR in trying to get this to work, perhaps I havenā€™t deleted one of them and itā€™s causing the error, although when I run the command without the --env NEXTCLOUD_DATADIR command it works fine. I just went back and deleted any of the ones I know about but they are all empty. Is there a way to find these dangling folders somewhere? Iā€™m not sure where they would be saved since these are brand new instances of the docker run command.

Hey @ryguy

Lol, someone else had the same exact problem today. Have a look.

What are the chances! I went through that post, but I donā€™t see a solution. Your last recommendation is what I have been doing by using the --env NEXTCLOUD_DATADIR argument. The only differences I see are the --init (which I removed and didnā€™t make a difference) and the changes for the reverse proxy Iā€™m using (which shouldnā€™t cause an issue of nextcloud installation with the error I have posted). I pasted the running command below:

docker run --init --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 8080:8080 --env APACHE_PORT=11000 --env APACHE_IP_BINDING=0.0.0.0 --env NEXTCLOUD_DATADIR="/run/desktop/mnt/host/f/Nextcloud" --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume //var/run/docker.sock:/var/run/docker.sock:ro nextcloud/all-in-one:latest

When I run it normally and look in the /run/ folder in the master container I only see apache, sudo, supervised, and docker.sock folders. When I look in the nextcloud-aio-nextcloud container I see samba, sudo, and supervised. It definitely seems like a mounting or volume issue, but when I make a volume it doesnā€™t seem to work. For example I made a volume with

docker volume create --opt type=none --opt device=/f/Nextcloud --opt o=bind nextcloud_f

then after I cleared out the Nextcloud docker stuff I ran

docker run --init --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 8080:8080 --env APACHE_PORT=11000 --env APACHE_IP_BINDING=0.0.0.0 --env NEXTCLOUD_DATADIR="/data" --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume nextcloud_f:/data --volume //var/run/docker.sock:/var/run/docker.sock:ro nextcloud/all-in-one:latest.

When I ran this it installed properly, but I didnā€™t see any of the installation files or setup files in the F:\Nextcloud folder at all while in the docker in the /data folder they are there. Is there a proper way to link that volume so that they are accessible? Perhaps there some weird trick to do with docker seeing the /run/desktop/mnt/hostpath or docker changed it, or thereā€™s some setting the blocks it that I can disable? Iā€™m quite puzzled.

@ryguy there is no need to create another volume, try this command.

docker run --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 80:80 --publish 8080:8080 --publish 8443:8443 --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume //var/run/docker.sock:/var/run/docker.sock:ro -e NEXTCLOUD_DATADIR="/run/desktop/mnt/host/f/ncdata" nextcloud/all-in-one:latest

Change the ā€˜NEXTCLOUD_DATADIRā€™ at the end to something like /run/desktop/mnt/host/d/ncdata, the last part ā€˜/d/ncdataā€™ is the windows location in linux format. ā€œD:\ncdataā€ = ā€œd/ncdataā€

Sebastian

Well Iā€™ve tried this so many times that Iā€™m getting this error now:

code": "TOOMANYREQUESTS",
      "message": "You have reached your pull rate limit. You may  (truncated...)
NOTICE: PHP message: Could not get digest of container nextcloud/all-in-one:latest Client error: `GET https://registry-1.docker.io/v2/nextcloud/all-in-one/manifests/latest` resulted in a `429 Too Many Requests` response:

Which is rather frustrating. Nonetheless, I turned off my caddy and tried the snippet you had above when the folder didnā€™t exist, and it seemed to give an error (but only because it couldnā€™t download the other containers). I tried again where the folder was already made and the nextcloud logs throw this error:

Installing with PostgreSQL database
Starting Nextcloud installation...
Username is invalid because files already exist for this user
Installation of Nextcloud failed!
              now              
-------------------------------
 2023-09-02 19:43:30.479062+00
(1 row)

None of these times did I notice any files put into the target data folders on the windows machine.

Honestly I can try any other way to install it if you have any recommendations, this has been very frustrating, although Iā€™m not familiar with VM software and imagine Iā€™d hit similar roadbumps.

@ryguy

Do this,

  1. Delete all nextcloud containers, images, volumes from docker
  2. From the windows console, run the command Iā€™ve given you, make sure you change the folder to what you need.
  3. After the initial container is running. Navigate to 'https://localhost:8080 in your browser.
  4. Start the install process, from the web interface.
  5. Be patient. It takes some time for the install to complete.

If you do this, after the install completes, you should see some folders and files in the folder from step 2. Theses are the data files from NC. And any new files you add through NC should show up there.

FYI, I just did this today, on a Win 10 Pro machine with a secondary drive and worked perfectly.

Sebastian

Okay Iā€™ll give it a shot:

  1. I ran this command to clean everything up:
docker stop nextcloud-aio-mastercontainer
docker stop nextcloud-aio-domaincheck
docker container prune
docker network rm nextcloud-aio
docker volume prune --filter all=1
docker image prune -a
rm -r F:\Nextcloud
mkdir F:\Nextcloud
  1. Then I ran this command:
docker run --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 80:80 --publish 8080:8080 --publish 8443:8443 --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume //var/run/docker.sock:/var/run/docker.sock:ro -e NEXTCLOUD_DATADIR="/run/desktop/mnt/host/f/Nextcloud" nextcloud/all-in-one:latest

that you just posted.
3-5. I went to https://localhost:8080/ and followed the install like normal with my domain, which gave no error. I deselected all the optional add-ons since Iā€™ll add them later if I want them, saved changes, then hit Download and start containers.

When it went to the next page Apache, Nextcloud, and Notify push are all yellow and (starting), whereas Reddis and Database are green and (running). When I check the logs, I note that for Nextcloud it gives this error which repeats and Nextcloud never turns green:

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Installing imagemagick via apk...
Enabling Imagick...
Configuring Redis as session handler...
Setting php max children...
The initial Nextcloud installation failed.
Please reset AIO properly and try again. For further clues what went wrong, check the logs above.
See https://github.com/nextcloud/all-in-one#how-to-properly-reset-the-instance

When I look in F:\Nextcloud it is empty.

Is this drive formatted as NTFS?

It is! I thought that linux could read NTFS, but in my experience it has all sorts of permission errors with it still for some reasonā€¦ Perhaps I can reformat it as exFAT? Do you think that would help?

Formatting the drive to exFAT didnā€™t seem to help, unfortunately. Thanks for all your help up to this point by the way. I really appreciate it.

I looked and perhaps the reason it works for you is that you are running Win10 Pro and Iā€™m running Win10 Home. It seems that Pro can do HyperV whereas Home runs it through WSL. Could someone try it on a Win10 Home computer and let me know? If not then Iā€™m just going to wipe my computer and use ubuntu, because this has been such a hassle.

No, WSL shouls be able to do this. However I have the feeling that Docker Desktop or WSL is not able to handle external drives.