Mounting external NAS share to container

I have been running several containers on a Synology NAS for a while now, but decided to move things off of the NAS onto my server and use the NAS solely for storage.

After a lot of trial and error I have finally managed to get the containers I want to use spun up and running and things seem to be going well.

A few containers such as Immich, Navidrome, Paperless-NGX need access to where the data is stored on the nas, this is where I am getting a little frustrated as no matter what I do I cannot get the NAS share to mount in docker so it is available to use in the container.

I am running Docker Desktop v4.69.0 with WSL2 ON a Windows11 Pro computer, the NAS is Synology and all the shares are SMB.

I have tried mapping the shares to drive letters in Windows and then adding that to the container but did not seem to work. (clicking the Bind mount within docker desktop would open the location in windows but still not available in the container)

I have also tried mapping using the ip address //192.168.2.125/volume1/Photos I can see the shares in the Bind mounts in the container but if click on it nothing happens.

Anyone able to give me any pointers on this as after 2 days on this I am going round in circles it seems

Thanks for any advice in advance

I don’t understand this part. How do you click in a container?

Also can you share how you create the container? Are you using the cli in the terminal or compose file? If you do, please, share the command or compsoe file in a codeblock using markdown (or the </> button)`

The documentation shows how you can use cifs to mount a samba share.
https://docs.docker.com/engine/storage/volumes/#create-cifssamba-volumes

Quote:

Create CIFS/Samba volumes

You can mount a Samba share directly in Docker without configuring a mount point on your host.

 docker volume create \
	--driver local \
	--opt type=cifs \
	--opt device=//uxxxxx.your-server.de/backup \
	--opt o=addr=uxxxxx.your-server.de,username=uxxxxxxx,password=*****,file_mode=0777,dir_mode=0777 \
	--name cifs-volume

The addr option is required if you specify a hostname instead of an IP. This lets Docker perform the hostname lookup.

1 Like

Hi, thanks for the reply, sorry not explaining myself very well. only just learning this, when I say click in a container I mean in this area

In the example above if I click on the mapped windows drive A: it opens on the screen in file explorer, I am guessing this is just pointing to the local drive in windows and not actually doing anything in regards to docker.

I am creating the containers using docker-compose.yml and then spinning up with docker-compose up -d

I had seen similar posts with examples as you have posted but none seemed to work (I will give it another try and see how I get on using your example again)

I have about 7 or 8 containers now running, the main issue I have is if I want to give them access to my data stored on my NAS everything else seems fine

You mounted folders from the Windows host into the container running in Docker Desktop’s virtual machine. When you click on the Windows path, it can only open the folder on Windows. If you go to the ā€œFilesā€ tab instead of the ā€œbind mountsā€, you can browse the filesystem in the container. I don’t recommend changing anything as it changed the oner of the file when I tried last time, but you can use it for checking if the content is available in the container under /music and /data.

I am not sure if that is enough on Windows to mount a locally mounted remote filesystem. If really necessary, I can try, but it would take time for me. The best would be if you could configure the mount through Docker.