Docker Community Forums

Share and learn in the Docker community.

Bind mounts broken in beta14


(Rob Landers) #1

Expected behavior

To be able to mount a directory and edit files as an unprivileged user in the container. There’s no way to change permissions outside the container…

Actual behavior


Steps to reproduce the behavior

  1. Create a file, say, index.php in the current directory
  2. docker run -p 80:80 -v index.php:/var/www/html/index.php --name tester php:7-apache
  3. get inside the container, docker exec -it tester bash
  4. inside the container, view the permissions: ls -lah
-rwxr-xr-x  1 root     root      758 Jun  9 05:17 index.php

As a windows user, I expect the permissions to be 777, as they would be if I COPY them in a Dockerfile.

(Dieter Menne) #2

When I follow your example, a file index.php is in the Windows folder, but inside the container it is a directory! Which would explain the permissions.

Try (successfully)

cd index.php

(Rob Landers) #3

I figured out what had happened. I had forgotten that a volume is a absolute path, and it was actually creating a local volume instead of the bind mount. Once I put in the full path, I have everything as I would expect.

(Fiberoptic) #4

Or you can use a relative path using **./**yourfile