docker以--volume运行 [英] docker run with --volume

查看:78
本文介绍了docker以--volume运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的机器上对一些服务进行docker化以进行开发,并想知道 docker如何运行--volume = .. 。例如,如果我做类似

I'm trying to dockerize some services for development on my machine and wondering how docker run --volume=.. works. For example, if I do something like

docker run --volume=/path/to/data:/data [...]

/ path / to / data 仅在本地(strong)不存在的情况下(重新)创建吗?是从容器的映像复制了初始数据吗?

希望提供有关文档的链接。

will /path/to/data be (re)created locally only if it doesn't exist? Is the initial data copied from the container's image?
Links to relevant documentation would be appreciated.

推荐答案

-卷选项在 docker run 参考文档,它会将您转发到专用的 容器中的托管数据 docs,然后将您转发到 绑定架 文档。

The --volume option is described in the docker run reference docs, which forwards you on to the dedicated Managed data in containers docs, which then forwards you on to the Bind mounts docs.

在其中显示:


如果使用 -v -volume 绑定安装Docker主机上尚不存在的文件或目录, -v 将创建端点为了你。始终将其创建为目录。

If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v will create the endpoint for you. It is always created as a directory.

这篇关于docker以--volume运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆