运维木子小李架构师之路
当前位置: docker容器编排教程 > docker 镜像为什么分层 ?

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

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

如果多个容器共享一份基础镜像,当某个容器修改了基础镜像内容,比如/etc/下的文件,这时其他容器的/etc/是不会被修改的,修改只会被限制在单个容器内,这就是容器copy-no-write特性。

docker数据卷(volume)
什么是docker数据卷
场景1 ,当 docker run mariadb容器,增删改数据后,删除mariadb的容器,但是要吧数据保存下来,怎么办 ?

场景2 mariadb容器配置文件更新,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.

为了容器的持久化和同步操作!也支持容器间数据共享

总结 容器的持久化和同步操作,容器间数据共享

「梦想一旦被付诸行动,就会变得神圣,如果觉得我的文章对您有用,请帮助本站成长」

分享到:
赞(0) 打赏
多谢大佬的支持

支付宝扫一扫打赏

微信扫一扫打赏

标签:

上一篇:

下一篇:

相关推荐

0 条评论关于"docker 镜像为什么分层 ?"

最新评论

    暂无留言哦~~

博客简介

精彩评论

站点统计

  • 文章总数: 29 篇
  • 草稿数目: 0 篇
  • 分类数目: 14 个
  • 独立页面: 0 个
  • 评论总数: 8 条
  • 链接总数: 6 个
  • 标签总数: 12 个
  • 注册用户: 48 人
  • 访问总量: 8,682,132 次
  • 最近更新: 2023年5月21日
服务热线:
 17608504224

 QQ在线交流

 旺旺在线