0

I am using Docker Desktop for Windows 10 Pro.

Using Git Bash (run as Administrator) I am trying to run a docker container of a ruby image and mount my current working directory in a '/app' directory inside the container with docker volumes.

docker run -it -v "/$(pwd)":/app ruby:2.4 sh

and inside the container the app directory is created like so:

drwxrwxrwx   1 root root 4096 Jul  6 19:25 app

However, when I try to read this directory inside the container I get the message:

ls: reading directory 'app': Operation not permitted

I tried getting a bash shell instead of sh and execute ls as root but same thing happened.

antoniskak
  • 25
  • 5
  • I also tried passing an **absolute path** instead of `pwd` but this created an empty directory of `'\Program Files\Git\app'`inside the container. – antoniskak Jul 06 '20 at 20:32
  • 1
    See [here](https://stackoverflow.com/questions/58482352/operation-not-permitted-from-docker-container-logged-as-root). It's likely that Docker does not have permission to read the directory on your host machine. – zr0gravity7 Jul 06 '20 at 20:37
  • 1
    Thank you @zr0gravity7. That was the issue indeed. I had previously given permission to docker to access the directory, however when I visited Docker Settings > Resources > File Sharing I realised that the absolute path to the directory was joined with the ';C' for some reason so i just reapplied the correct path and it worked. – antoniskak Jul 06 '20 at 20:59

0 Answers0