2

On mac, /a/b is with below permissions:

$ ls -l /a/b
total 0
drwxrwxrwx  2 root  wheel  64 13 Jan 08:50 b
$  whoami
user1
$

Below is the docker-compose file to mount /a/b from docker container:

version: '2'

services:
  someapp:
    build:
      context: .
      args:
        DOCKER_GID: ${DOCKER_GID}
        DOCKER_VERSION: ${DOCKER_VERSION}
        DOCKER_COMPOSE: ${DOCKER_COMPOSE}
    volumes:
      - /a/b:/var/some_mount
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8080:8080"

On running docker-compose up -d someapp, I see below error:

ERROR: for docker-folder_someapp_1  Cannot start service someapp: b'Mounts denied: \r\nThe path /a/b\r\n is not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'

ERROR: for someapp  Cannot start service someapp: b'Mounts denied: \r\nThe path /a/b\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'
ERROR: Encountered errors while bringing up the project.

Following the instructions when I add /a/b using File sharing option to existing list:

enter image description here

I get another error popup: The export path /Users/user1/Documents/:a/:a:b overlaps with the export /Users


Another observation is, installing docker on MacOS, using VMWare to run docker, unlike ubuntu :

$ ps -eaf | grep docker
    0 11100     1   0  9:02am ??         0:00.07 /Library/PrivilegedHelperTools/com.docker.vmnetd
1873530912 11108 11038   0  9:02am ??         0:01.45 /Applications/Docker.app/Contents/MacOS/com.docker.supervisor -watchdog fd:0

I do not see such mount deny issues, running docker daemon in Ubuntu.

1)

How to mount path(/a/b) of docker host to docker container's(/var/some_mount) ? in macos

2)

Is the explicit file sharing needed from docker host, because, docker installation on MacOS makes docker host run on VMWare and docker client run on MacOS?

overexchange
  • 15,768
  • 30
  • 152
  • 347
  • So `/a/b` is somewhere in your `/Users` directory? What happens if you `chown` to your login? – leeman24 Jan 13 '20 at 18:37
  • @leeman24 I changed to `drwxrwxrwx 2 user1 wheel 64 13 Jan 08:50 /a/b`. I still see the same issue. There is no group by name `user1`, so am not sure, what group name are you expecting for this path? – overexchange Jan 13 '20 at 18:53
  • It might be a Docker on mac quirk. You should consider mounting the folder from somewhere in the /Users directory. I feel like the / folder may be protected. – leeman24 Jan 13 '20 at 19:09
  • @leeman24 Can you also check my query edit? – overexchange Jan 13 '20 at 19:22
  • I actually got bored and recreated your scenario. I created the folder `/a/b` which is still owned by `root:wheel`. Reproduced the mount denied error. However when I tried to share the folder `/a/b` in the docker settings, it worked. – leeman24 Jan 13 '20 at 20:47
  • @leeman24 I also tried sharing, but I see the error shown in query. – overexchange Jan 13 '20 at 21:02
  • Do you have any symlinks? Why is it referring to your `/Users` directory (`/Users/user1/Documents/:a/:a:b`)? Also, why are there colons? – leeman24 Jan 13 '20 at 21:08
  • @leeman24 No symlinks. Not sure, why are they colons? – overexchange Jan 13 '20 at 21:44
  • I'm on Docker version 2.1.0.1 (37199) if that helps. I can confirm this works. I suggest you try sharing the directory again which shouldn't reference your `/Users` directory. Maybe upload the screenshot with that step so we can see what it looks like. – leeman24 Jan 13 '20 at 21:58

0 Answers0