gpt4 book ai didi

Docker 挂载卷错误 : includes invalid characters for a local volume name

转载 作者:行者123 更新时间:2023-12-05 01:07:50 25 4
gpt4 key购买 nike

关于以下相同的错误消息有很多问题,但我仍然找不到解决方案。

docker: Error response from daemon: create /Users/siyang/Desktop/source: 
"/Users/Jake/Desktop/source" includes invalid characters for a local volume name,
only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed.
If you intended to pass a host directory, use absolute path.

这是我运行的 docker 命令。我正在使用绝对路径并且允许使用字符。

docker run \
-p 5000:5000 \
--mount type=volume,source=/Users/jake/Desktop/source,target=/data \
--name testvol test

令人惊讶的是,当我使用相同的命令进行绑定(bind)挂载时,它运行良好。

docker run \
-p 5000:5000 \
--mount type=bind,source=/Users/jake/Desktop/source,target=/data \
--name test test

[更新]

我正在使用 macOS Big Sur,Docker v3.2.2。

最佳答案

如果您打算将主机目录映射到容器,则不应使用卷挂载。我不认为卷安装符合您的预期。

来自文档:

Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure and OS of the host machine, volumes are completely managed by Docker.

Bind mounts用于将主机上的目录映射到容器中的目录。

Volume mounts用于映射现有的 Docker 卷(即使用 docker volume create VOLUMENAME 创建)。 Docker 卷的名称中不能包含 /

关于Docker 挂载卷错误 : includes invalid characters for a local volume name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66898187/

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