本文主要是介绍基于Volume 的互联,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
创建一个立刻删除的景象
[root@localhost volumes]# docker run --rm=true -it -v /leader java /bin/bash
查看这个镜像的映射路径
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fd7726db99bc java "/bin/bash" 2 minutes ago Up 2 minutes goofy_curie
b3be9a2edb91 java "/bin/bash" 10 minutes ago Up 10 minutes quizzical_knuth
a4d03135f4b3 mysql "docker-entrypoint..." 4 hours ago Up 4 hours 0.0.0.0:3306->3306/tcp mysql1[root@localhost ~]# docker inspect goofy_curie...."Mounts": [{"Type": "volume","Name": "0db5733d4b040c3b8774ea0d6c455929db3fbf4a4711af5c921cda57518c814f","Source": "/var/lib/docker/volumes/0db5733d4b040c3b8774ea0d6c455929db3fbf4a4711af5c921cda57518c814f/_data","Destination": "/leader","Driver": "local","Mode": "","RW": true,"Propagation": ""}],
可以多个容器中的Volume 指向同一个本机目录,实现基于文件的共享访问
docker run --rm=true -it -v /storage /leader java /bin/bash
这篇关于基于Volume 的互联的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!