A
A
Alexey Shein2017-11-20 16:27:48
Debian
Alexey Shein, 2017-11-20 16:27:48

How to correctly set the rights to mounted volumes and folders inside containers in docker-compose universally for any OS?

Two machines - macOS and debian. You need to run an app on them, which is deployed by a docker compose. At the same time, external volumes and folders are mounted in one of the containers not only for reading, but also for writing. On a Mac, users of these containers immediately receive the necessary rights and can write to folders. There are no such rights on Debian - the owner of the volume and folder is either root or 1001.
Can this be somehow universally configured for both OSes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Shein, 2017-11-20
@Lexx918

I gave up on a universal solution and simply fixed specific rights on external folders. To do this, first I gave them full access 0777, then I wrote a test file to the folder as a user from the docker. See who owns it. It already exists on the host (good old www-data). I just gave the rights to these folders exclusively to him alone:

chown -R www-data:www-data folder
chmod u+rw,go-rw  folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question