Question

How do I give correct permissions to shared volumes in Docker?

I followed this guide https://www.digitalocean.com/community/tutorials/how-to-share-data-between-docker-containers and created a volume that I share between my samba and nextcloud containers. However, samba and nextcloud are accessing it from different usernames, and I can’t find a way to make them both have read/write access to it. I’ve tried to create a group (on the host, where the volume is located) and put both www-data and the samba user in that group and give that group write permission on the volume. But somehow only the user who is chown the volume can read, even if it’s also chown to the group. Any suggestions on this?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @2panomitrius,

Do you have write permissions for the group as well?

What I could suggest is also taking a look at this tutorial here on how to share data between containers with volumes:

https://www.digitalocean.com/community/tutorials/how-to-share-data-between-docker-containers

Regards, Bobby