Docker绑定安装用法 [英] Docker bind mount usage
问题描述
我们的应用程序在unix盒(例如box1)上运行,在该盒上将一个nfs文件管理器安装在/var/app/data
目录中.
Our application is running on a unix box(let's say box1) on which one nfs filer is mounted on /var/app/data
directory.
应用程序在已安装的目录/var/app/data
上写入一些文本文件.
Application writes some text file on the mounted directory /var/app/data
.
我们的下游应用程序(在某些其他Unix框上运行)将读取nfs filer中存在的这些文件.我们正计划将我们的应用程序迁移到docker.
Our downstream application (running on some other unix box) will read these files as they are present on nfs filer. We are planning to migrate our application to docker.
我正在考虑使用绑定安装功能,因为它将允许我将主机(box1)目录/var/app/data
映射到容器中的任何目录.
I am thinking to use bind-mount feature as it will allow me to map host machine(box1) directory /var/app/data
to any directory in container.
但是,我发现大多数博客都建议使用卷而不是绑定卷.有人可以据我所知如何在我的场景中使用卷挂载,在创建卷时我们不能提及源目录(在我的情况下为/var/app/data
).
However I have found most blogs suggesting to use volumes over bind-mount.
can someone please how to use volume mount in my scenario as upto my understanding, we can not mention source directory (/var/app/data
in my case) while creating the volume.