您当前的位置: 首页 >  docker

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

发布时间:2021-02-02 12:53:17 ,浏览量:0

1 Docker架构和底层技术简介

Docker Platform Docker Engine Docker Architecture 底层技术支持

2 Docker Image概述

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

  • bootfs(boot file system) 主要包含 bootloader 和 kernel,bootloader 主要用于引导加载 kernel,当 kernel 被加载到内存中后 bootfs 会被 umount 掉
  • rootfs (root file system) 包含的就是典型 Linux 系统中的/dev,/proc,/bin,/etc 等标准目录和文件 docker image 中最基础的两层结构 不同的 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 一样
2.2 image的获取 image的获取-1

image的获取-2

image的获取-2 sudo docker pull ubuntu:16.04 官方镜像仓库

3 DIY Base Image

无需再用 sudo 权限 运行结果 vim Dockerfile docker build -t root/hello-world . docker run root/hello-world

容器镜像

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0529s