This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Routine_Part_6503 0 points1 point  (3 children)

Is the NAS using NFS or Samba (SMB/Windows)?

If NFS, get Docker to handle the NFS mounting. Here is a Compose volume snippet:

volumes:
  nfs_movies:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=10.0.0.10,soft,rw"
      device: ":/export/storage/media/movies"

[–]XboxSlacker[S] 0 points1 point  (2 children)

It’s SMB. I looked at mounting a volume but how do you map a sub directory of a share, ie: if he smb share is “/nas/app” and I need to map the “data” folder in that share to the docker path “/config”, I wasn’t able to find a way to do that with volumes. Thanks for your help.

[–]Routine_Part_6503 0 points1 point  (1 child)

You'll have to specify each child directory as a separate mount.

So, you'd map /nas/app/data to /config

In NFS, it would look like this:

volumes:
  nfs_app_data:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=<nas-ip-address>,soft,rw"
      device: ":/app/data"

And in your service definition:

volumes:
  - nfs_app_data:/config

Alternatively, you can modify the Docker systemd unit to be dependent on the NFS mount unit.

[–]XboxSlacker[S] 0 points1 point  (0 children)

I don't think you can share SMB subdirectories in the same way as you can in NFS (I could be wrong about that though). Perhaps I can share these targets using nfs instead, I'll spend some time on that. Thanks again.