在Docker中创建和绑定安装文件
Docker主机上不需要该文件或目录。如果不存在,它是按需创建的。
文件夹是正确的:如果我将安装绑定为:
docker run -v $ pwd/mydir:/mydir映像:版本
,然后创建mydir
文件夹并绑定在容器中。但是我找不到在上面链接页面或其他任何地方对文件做同样的事情的语法。
The Docker documentation about bind mounts states that:
The file or directory does not need to exist on the Docker host already. It is created on demand if it does not yet exist.
This is true for folders: if I bind mount as:
docker run -v $PWD/mydir:/mydir image:version
then the mydir
folder is created and bind mounted in the container. But I cannot find the syntax for doing the same thing for a file either at the above linked page nor anywhere else.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档不一致。上面有一个空旷的问题: https://github.com/docker.com/docker.com/docker/docker/docker/docker/docker/docker/docker 。
或使用
- MOUNT
语法会失败。The documentation is inconsistent. There's an open issue on it: https://github.com/docker/docker.github.io/issues/10133
Docker always creates a directory if the host path doesn't exist. Or fails if you use the
--mount
syntax.