I noticed this behavior yesterday when trying to bind-mount a local directory containing a webapp into my container so I could work on it without having to restart the container after every change. The app's framework is very particular about permissions, so I thought I'd try using docker exec to change them. The run command is something like:
docker run -v /Users/sboynton/project/webapp/:/app -t imagename
Then I ran the following to check permissions:
docker exec container_name ls -la /app
Which gives:
[...]
-rw-r--r-- 1 1000 staff 174 Jun 26 22:24 build.properties
-rw-r--r-- 1 1000 staff 10347 Jun 26 22:24 build.xml
-rw-r--r-- 1 1000 staff 1464 Jun 26 22:24 index.php
drwxr-xr-x 1 1000 staff 102 Jun 26 22:24 lib
drwxr-xr-x 1 1000 staff 102 Jun 26 22:24 plugins
[...]
The following command should work, and does on files created by e.g. "docker exec container_name touch file_name", but doesn't in this scenario:
docker exec container_name chown www-data:www-data /app/build.xml
Running ls -la /app/build.xml still returns:
-rw-r--r-- 1 1000 staff 10347 Jun 26 22:24 build.xml
Some other things that have been tried are creating a new file in the container's /tmp directory and attempting the same ownership change (works), creating a new file via docker exec in /app and attempting the same (fails), and attempting to change ownership using uid/gid instead of names (e.g. 33:33) (fails). chown, chgrp and chmod all exhibit this same behavior.
If this is a Docker issue and not a boot2docker issue, please let me know and I'll take the issue over there. However, users who tried the above from a Linux Docker host instead of through boot2docker were able to successfully modify permissions/ownership, which leads me to believe this is an issue with boot2docker.
I noticed this behavior yesterday when trying to bind-mount a local directory containing a webapp into my container so I could work on it without having to restart the container after every change. The app's framework is very particular about permissions, so I thought I'd try using docker exec to change them. The run command is something like:
Then I ran the following to check permissions:
Which gives:
The following command should work, and does on files created by e.g. "docker exec container_name touch file_name", but doesn't in this scenario:
Running ls -la /app/build.xml still returns:
Some other things that have been tried are creating a new file in the container's /tmp directory and attempting the same ownership change (works), creating a new file via docker exec in /app and attempting the same (fails), and attempting to change ownership using uid/gid instead of names (e.g. 33:33) (fails). chown, chgrp and chmod all exhibit this same behavior.
If this is a Docker issue and not a boot2docker issue, please let me know and I'll take the issue over there. However, users who tried the above from a Linux Docker host instead of through boot2docker were able to successfully modify permissions/ownership, which leads me to believe this is an issue with boot2docker.