I am trying to connect to an SMB share via Docker Compose and it will not give write permissions
Matthew Martinez
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/downloadsI 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-stoppedThis 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/downloadsit now connects as expected.