I am trying to connect to an SMB share via Docker Compose and it will not give write permissions

I am new to docker. I am attempting run a docker server on a raspberry pi and have the volumes point to a network share so I can avoid persistent files directly on the pi. I am using docker compose and am attempting to mount an SMB share from my Unraid server to the docker containers utilizing volumes.

This is how I have tried mounting the SMB shares:

volumes: downloads: driver_opts: type: cifs o: username=COOLUSERNAMEHERE,password=SUPERSECRETPASSWORD,vers=3 device: //192.168.0.110/downloads

I then mount this volume inside the container as follows:

services: myservicename: image: theplaceigetmyimagefrom container_name: myservice environment: - PUID=1000 - PGID=1000 - TZ=America/Toronto volumes: - downloads:/downloads ports: - 1234:1234 restart: unless-stopped

This volume mounts just fine however it mounts as read only. No matter what I do I cannot get it to have write permissions. I again am new to docker. So I am probably trying the wrong stuff. I have tried adding privileged: true to the container but that didn't change anything. The SMB share I am connecting to is set to public and shared so there shouldn't be any user issues, however I have also logged in with a user that has "read/write"access to that folder as setup in Unraid itself.

Any ideas on next steps would be appreciated.

1 Answer

Figured this out. I changed the version to 3.0 (not sure if that did anything at all) and I added GID and UID and the rw option:

volumes: downloads: driver_opts: type: cifs o: username=COOLUSERNAMEHERE,password=SUPERSECRETPASSWORD,uid=1000,gid-1000,vers=3.0,rw device: //192.168.0.110/downloads

it now connects as expected.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like