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

Posted December 7, 2020 3.8k views
UbuntuDockerUbuntu 18.04Ubuntu 20.04

I followed this guide 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?

1 comment

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.

Submit an Answer
1 answer

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:


by Melissa Anderson
In general, Docker containers are ephemeral, running just as long as it takes for the command issued in the container to complete. Sometimes, however, applications need to share access to data or persist data after a container is deleted. In this article, we'll look at four different ways to share data between containers.