0
点赞
收藏
分享

微信扫一扫

Docker入门实战(三)-Docker容器镜像

罗蓁蓁 2022-03-14 阅读 43


1 Docker架构和底层技术简介

Docker入门实战(三)-Docker容器镜像_linux

Docker入门实战(三)-Docker容器镜像_docker_02

Docker入门实战(三)-Docker容器镜像_加载_03

Docker入门实战(三)-Docker容器镜像_docker_04

Docker入门实战(三)-Docker容器镜像_linux_05

Docker入门实战(三)-Docker容器镜像_加载_06

2 Docker Image概述

Docker入门实战(三)-Docker容器镜像_docker_07

Docker入门实战(三)-Docker容器镜像_linux_08

从基本的看起,一个典型的 Linux 文件系统由 bootfs 和 rootfs 两部分组成,


  • bootfs(boot file system) 主要包含 bootloader 和 kernel,bootloader 主要用于引导加载 kernel,当 kernel 被加载到内存中后 bootfs 会被 umount 掉
  • rootfs (root file system) 包含的就是典型 Linux 系统中的/dev,/proc,/bin,/etc 等标准目录和文件
    Docker入门实战(三)-Docker容器镜像_linux_09
    不同的 linux 发行版(如 ubuntu 和 CentOS ) 在 rootfs 这一层会有所区别,体现发行版本的差异性
    传统的 Linux 加载 bootfs 时会先将 rootfs 设为 read-only,然后在系统自检之后将 rootfs 从 read-only 改为 read-write,然后就可在 rootfs 上进行读写操作了
    但 Docker 在 bootfs 自检完毕之后并不会把 rootfs 的 read-only 改为 read-write,而是利用 union mount(UnionFS 的一种挂载机制)将 image 中的其他的 layer 加载到之前的 read-only 的 rootfs 层之上,每一层 layer 都是 rootfs 的结构,并且是read-only 的。所以,我们是无法修改一个已有镜像里面的 layer 的!只有当我们创建一个容器,也就是将 Docker 镜像进行实例化,系统会分配一层空的 read-write 的 rootfs ,用于保存我们做的修改。一层 layer 所保存的修改是增量式的,就像 git 一样
    Docker入门实战(三)-Docker容器镜像_linux_10

2.2 image的获取

image的获取-1

Docker入门实战(三)-Docker容器镜像_docker_11

image的获取-2

Docker入门实战(三)-Docker容器镜像_docker_12

Docker入门实战(三)-Docker容器镜像_docker_13

Docker入门实战(三)-Docker容器镜像_linux_14

Docker入门实战(三)-Docker容器镜像_linux_15

3 DIY Base Image

Docker入门实战(三)-Docker容器镜像_docker_16

Docker入门实战(三)-Docker容器镜像_linux_17

Docker入门实战(三)-Docker容器镜像_docker_18

Docker入门实战(三)-Docker容器镜像_linux_19

Docker入门实战(三)-Docker容器镜像_加载_20

Docker入门实战(三)-Docker容器镜像_docker_21

Docker入门实战(三)-Docker容器镜像_加载_22

Docker入门实战(三)-Docker容器镜像_linux_23

Docker入门实战(三)-Docker容器镜像_加载_24

Docker入门实战(三)-Docker容器镜像_docker_25

容器镜像

Docker入门实战(三)-Docker容器镜像_加载_26



举报

相关推荐

0 条评论