[英]How to mount gluster volume to host folder in docker?
我已經像這樣運行了我的docker容器:
docker run -v /sys/fs/cgroup:/sys/fs/cgroup -v /opt/doc:/opt/doc \
--privileged=true --net=host -itd --name=gluster gluster-docker
然后將卷安裝到容器中的文件夾中:
mount -t glusterfs 192.168.1.100:/documents /opt/doc
當我將數據寫入真實服務器的/ opt / doc時,數據將不會rsync到容器的/ opt / doc。
安裝完文件夾后,有什么想法可以在容器和服務器之間rsync數據嗎?
gluster-docker: https : //github.com/gluster/gluster-containers
最后,我在docker -ce 17.06中找到了--mount 。
mount --bind /data/fff /data/fff
mount --make-shared /data/fff
docker run -v /sys/fs/cgroup:/sys/fs/cgroup -v /opt/doc:/opt/doc \
--privileged=true --net=host --mount \
type=bind,source=/data/fff,target=/data/fff,bind-propagation=rshared \
-itd --name=gluster gluster-docker
然后將卷安裝到容器中的文件夾:
mount -t glusterfs 192.168.1.100:/documents /data/fff
好。
https://docs.docker.com/engine/admin/volumes/bind-mounts/ https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.