You are not logged in.
I have development platform that use a docker-compose file. In this docker-compose, for one of the service, I mount a local directory as a directory of a container.
myservice:
image: node:8.1.2-alpine
working_dir:/bin
volumes:
- /home/myuser/path/to/my/src:/bin
This docker-compose.yml file works fine on another computer, but with this new computer, I have a unix rights problem.
When I launch my development platform with docker-compose up -d, the application in my source throws error saying that it can not write in the /bin directory.
If I go in the container with docker-compose exec mycontainer sh, I am able to list the files of my mounted volume, but I can not do a touch toto, I have the error "Permission denied".
My user belongs to the following groups:
tty lp wheel uucp users wireshark docker printadmin
Any ideas on how to solve this?
Last edited by Phasme (2019-06-30 17:37:24)
Offline
Ok so I found my problem.
The user I use on my new computer is not the first user created in the system so it uid and guid are 1001:1003, the first user created is 1000:1000. When a the container is ran, the user specified use the uid 1000 so it did not have the right to modify my personnal files.
I tried to force the container to run as an user with the same id as me like it is explained here:
* https://medium.com/redbubble/running-a- … 2e00f8ee15
* https://dev.to/acro5piano/specifying-us … docker-i2e
for example in my docker-compose:
# THIS BIT!!!1!
user: ${CURRENT_UID}
and using this command : CURRENT_UID=$(id -u):$(id -g) docker-compose up but without success.
So I changed the owner of my mounted directory
previously with user1:grp1 -> 1000:1000 and user2:grp2 -> 1001:1003
my_mounted_directory -> user2:grp2 with the right 755
I did the following command: chown -R user1:grp2 my_mounted_directory and chmod -R 775 my_mounted_directory
now :
my_mounted_directory -> user1:grp2 with the rights drwxrwxr-x
Offline