Help mount to Synology NAS folder in my docker compose file

It looks like the issue in this thread is very similar and it got me most of the way but I still could use a little help.

I am trying to mount my audiobook folder on my Synology NAS to my docker container so I can access it from my Audiobookshelf server I am setting up on my Mac mini.

Here is my compose file:

services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:latest
    ports:
      - 13378:80
    volumes:
      - /Users/myuser/Documents/docker/audiobookshelf/config:/config
      - /Users/myuser/Documents/docker/audiobookshelf/metadata:/metadata
      - type: volume
        source: nas-data
        target: /audiobooks
    environment:
      - TZ=America/Denver
    restart: unless-stopped
    
volumes:
  nas-data:
    driver_opts:
      type: cifs
      o: "username=docker,password=*password*,vers=3.0"
      device: //192.168.4.175/volume1/data/media/audiobooks/audiobooks

When I start up the container I get an error of permission denied. My question is, am I supposed to use the user/password of my Synology or the user/password of my mac mini user?

Another question is, do I need to specify my volume up top as such:

    volumes:
      - type: volume
        source: nas-data
        target: /audiobooks

or can it just be:

    volumes:
      - nas-data:/audiobooks

I appreciate any help you can give.

cifs requires credentials. So yes, you need the credentials of a Synology user that is allowed to access the cifs share. Personally, I prefer nfsv4 shares instead as it requires not credentials - you can limit which ip or subnet ranges can access the share though.

The first is the long syntax, it allows additional configuration items. The 2nd is the short syntax. Use whatever you prefer.

I’m open to using anything that works. I tried messing around with NFS and never got it to work so I switched over to cifs because that was used in the other thread. Here is my compose file with NFS and I’m still not able to access my audiobooks folder. I believe I have all the permissions setup on the NAS.

services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:latest
    ports:
      - 13378:80
    volumes:
      - /Users/myuser/Documents/docker/audiobookshelf/config:/config
      - /Users/myuser/Documents/docker/audiobookshelf/metadata:/metadata
      - type: volume
        source: nas-data
        target: /audiobooks
        volume:
          nocopy: true
    environment:
      - TZ=America/Denver
    restart: unless-stopped
    
volumes:
  nas-data:
    driver_opts:
      type: nfs
      o: addr=192.168.4.175,nolock,soft,rw
      device: :/volume1/data

It is throwing this at me when I recreate the container:

Volume "audiobookshelf_nas-data" exists but doesn't match configuration in compose file. Recreate (data will be lost)?

I just tell it “yes” but I’m not quite sure what the “audiobookshelf_nas-data” is referring to.

Finally, a drift between existing volumes and volume configuration in the compose file is implemented :slight_smile: Thank you for sharing it, I was not aware of it. This used be silently ignored in the past.

The convention is {project-name]_{resource-name}. So either the folder where your compose file is located is named audiobookself or you deployed the resource with docker compose -p audiobookshelf (or --project-name instead of `-p)

Is not true for nfs and cifs shares. The only thing you loose is the configuration on how the remote share needs to be accessed, which your configuration update changes anyway.

1 Like

So either the folder where your compose file is located is named audiobookself or you deployed the resource with docker compose -p audiobookshelf (or --project-name instead of `-p)

The folder that contains my compose.yaml file on my mac is named “audiobookshelf”. I started the container using docker compose up -d. So that makes sense.

Is not true for nfs and cifs shares.

I figured as much since I’m just trying to access a network drive. I haven’t lost any data and have always told it yes.

However, I am still unable to access any of my files on NAS through my audiobookshelf server. I’m guessing at this point, it’s not my compose file and something to do on the NAS side?

Try it like this:

volumes:
  nas-data:
    driver_opts:
      type: nfs
      o: addr=192.168.4.175,nfsvers=4
      device: :/volume1/data

Once it’s working, try to add additional options, but skip rw or ro. Those never worked for me.

I get permission denied errors when using version 4 but It’s turned on in my NAS NFS settings. I’m thinking there is some issues with the networking between the container and the NAS because I have to define a subnet of IP addresses to give access to NFS.

Anyway, I think solving this is beyond my ability. I will have to just run the server on my NAS itself. I was just trying to learn some new things and run it on my mac. Thank you.

I think the nfs permissions on your share need a little nudge:

  • either use the mac ip, like 192.168.0.10, or the subnet, e.g. 192.168.0.0/24
  • Make sure to check the box on “Allow connections from non-privileged ports (ports higher than 1024)”.

At least Docker Desktop on Windows required it to be checked, which docker-ce on my linux vms doesn’t require it to be checked.

You are almost there :slight_smile:

I added a permission for my mac mini and my entire subnet on the Synology NSF settings to ensure I could connect. I also had the “Allow connections from non-privileged ports (ports higher than 1024)” selected. I was still unable to view any of my files within my ABS server once I spun it up.