I have ran my docker container like this:
docker run -v /sys/fs/cgroup:/sys/fs/cgroup -v /opt/doc:/opt/doc \
--privileged=true --net=host -itd --name=gluster gluster-docker
then I mount a volume to a folder in container:
mount -t glusterfs 192.168.1.100:/documents /opt/doc
When I write data to the /opt/doc of my real server, the data won't be rsync to the /opt/doc of the container.
Is there any idea to rsync data between container and server after I have mounted the folder ?
gluster-docker: https://github.com/gluster/gluster-containers
Finally, I found --mount in docker-ce 17.06.
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
then I mount a volume to the folder in container:
mount -t glusterfs 192.168.1.100:/documents /data/fff
OK.
https://docs.docker.com/engine/admin/volumes/bind-mounts/ https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.