docker run -v /Users/xx/var/temp:/ -it alpine bash
但它提示:
invalid mount config for type bind: invalid specification: destination can't be /
为什么 alpine 主机目录无法挂载?
最佳答案
Docker 不允许您将主机目录或卷绑定(bind)到容器内的根目录 (/
)。您需要将其绑定(bind)在子目录中,例如:
docker run -v /Users/xx/var/temp:/var/temp -it alpine bash
这将使目录在容器内的 /var/temp
处可用。
关于docker 无法挂载 linux 目标/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52771664/