Mounts denied: \r\nThe path /a/b \r\n is not shared from OS X and is not known to Docker

4.9k Views Asked by At

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?

0

There are 0 best solutions below