2

在 mac 上,/a/b具有以下权限:

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

下面是 /a/b要从 docker 容器挂载的 docker-compose 文件:

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"

在运行docker-compose up -d someapp时,我看到以下错误:

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.

当我将/a/b使用文件共享选项添加到现有列表时,按照说明进行操作:

在此处输入图像描述

我收到另一个错误弹出窗口:The export path /Users/user1/Documents/:a/:a:b overlaps with the export /Users


另一个观察结果是,在 MacOS 上安装 docker,使用 VMWare 运行 docker,与 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

我没有看到这样的挂载拒绝问题,在 Ubuntu 中运行 docker daemon。

1)

如何将/a/bdocker 主机的路径()挂载到 docker 容器的(/var/some_mount)?在 macOS 中

2)

是否需要从 docker 主机进行显式文件共享,因为 MacOS 上的 docker 安装使 docker 主机在 VMWare 上运行而 docker 客户端在 MacOS 上运行?

4

0 回答 0