> docker容器编排教程 > docker 镜像为什么分层 ?

docker 镜像为什么分层 ?

镜像分层最大的一个好处就是共享资源,提升效率

比如说有多个镜像都从相同的base镜像构建而来,那么docker host 只需在磁盘上保存一份base镜像,同时内存中也需要加载一份base镜像,就可以为所有容器服务了,而且镜像的每一层都可以被共享

如果多个容器共享一份基础镜像,当某个容器修改了基础镜像内容,比如/etc/下的文件,这时其他容器的/etc/是不会被修改的,修改只会被限制在单个容器内,这就是容器copy-no-write特性。
docker 镜像为什么分层 ?
docker数据卷(volume)
什么是docker数据卷
场景1 ,当 docker run mariadb容器,增删改数据后,删除mariadb的容器,但是要吧数据保存下来,怎么办 ?
docker 镜像为什么分层 ?
场景2 mariadb容器配置文件更新,docker任何如何处理最简单?
docker 镜像为什么分层 ?
A volume is a specially-designated directory within one or more containers that bypasses the Union File System. Volumes are designed to persist data, independent of the container’s life cycle. Docker therefore never automatically deletes volumes when you remove a container, nor will it “garbage collect” volumes that are no longer referenced by a container. Also known as: data volume

目录,绕过联合文件系统。持久化数据,与容器生命周期无关

总结:容器与宿主机数据同步的一个对照目录

三种类型数据卷
There are three types of volumes: host, anonymous, and named:
A host volume lives on the Docker host’s filesystem and can be accessed from within the container.
A named volume is a volume which Docker manages where on disk the volume is created, but it is given a name.
An anonymous volume is similar to a named volume, however, it can be difficult, to refer to the same volume over time when it is an anonymous volumes. Docker handle where the files are stored.

为了容器的持久化和同步操作!也支持容器间数据共享
docker 镜像为什么分层 ?
总结 容器的持久化和同步操作,容器间数据共享

支付宝赞助
微信赞助

docker 镜像为什么分层 ?:等您坐沙发呢!

发表评论

表情
还能输入210个字