gpt4 book ai didi

macos - macOS 中卷的 docker 中的相对路径绑定(bind)失败

转载 作者:行者123 更新时间:2023-12-02 05:08:28 24 4
gpt4 key购买 nike

我正在使用 docker-compose,我想创建一个相对的两路径绑定(bind)。

Folder structure and path at the host machine:
/Users/username/Documents/Repos/docker-gulp-template/bla
docker-gulp-template
Dockerfile
docker-compose.yml
Bla (Folder)

Path structure inside the container:

/usr/src/html/bla

version: '3'
services:
bla:
command: /bin/bash
stdin_open: true
#tty: true
container_name: docker-gulp-template
#restart: always
build: .
ports:
- '80:3000'
volumes:
- "/bla:/usr/src/html/bla"

这确实会导致错误。

ERROR: for docker-gulp-template  Cannot start service bla: b'Mounts denied: \r\nThe path /bla\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.'
    volumes:
- ".:/usr/src/html/bla"

这个确实有效。

我确实找到了这个帖子: Docker: Mounts denied. The paths ... are not shared from OS X and are not known to Docker

但这对我根本没有帮助。我确实尝试将我的存储库文件夹添加到 docker 设置的文件共享选项卡中,但它不允许我添加该文件夹,因为它已经位于/Users 组内。

该路径是相对于 docker-compose/docker 文件的吗?

有人知道问题出在哪里吗?我真的很困惑。

提前致谢

最佳答案

您可以使用相对路径,在您的情况下它是

volumes:
- "./Bla:/usr/src/html/bla"

关于macos - macOS 中卷的 docker 中的相对路径绑定(bind)失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54322675/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com