Merge pull request #422 from 00Kai0/english

update image
This commit is contained in:
Kang Huaishuai 2019-10-02 22:06:52 +08:00 committed by GitHub
commit 3a3939686c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,15 @@
## Docker 镜像
## Docker Image
我们都知道操作系统分为内核和用户空间对于 Linux 而言内核启动后会挂载 `root` 文件系统为其提供用户空间支持 Docker 镜像Image就相当于是一个 `root` 文件系统比如官方镜像 `ubuntu:18.04` 就包含了完整的一套 Ubuntu 18.04 最小系统的 `root` 文件系统
As we all know, Operating System constitutes kernel and user space. For linux, it will mount `root` file system to support user space. For Docker Image, it almost likes a `root` file system. For example, the offical image `ubuntu:18:04` contains a micro `root` file system of complete opreating system.
Docker 镜像是一个特殊的文件系统除了提供容器运行时所需的程序资源配置等文件外还包含了一些为运行时准备的一些配置参数如匿名卷环境变量用户等镜像不包含任何动态数据其内容在构建之后也不会被改变
Docker Image is a special file system. Except for programes, libs, resources and config witch support running container, Docker Image also includes config parameters like anonymous volumes, environment variables, users and others. Images don't have any dynamic data. Its content will not be changed after build.
### 分层存储
## Advanced Multi-layered Unification Filesystem (AUFS)
因为镜像包含操作系统完整的 `root` 文件系统其体积往往是庞大的因此在 Docker 设计时就充分利用 [Union FS](https://en.wikipedia.org/wiki/Union_mount) 的技术,将其设计为分层存储的架构。所以严格来说,镜像并非是像一个 ISO 那样的打包文件,镜像只是一个虚拟的概念,其实际体现并非由一个文件组成,而是由一组文件系统组成,或者说,由多层文件系统联合组成。
Because the image contains the complete `root` file system of the operating system, its volume is often huge. So Docker made full use of [Union FS](https://en.wikipedia.org/wiki/Union_mount) and was designed as AUFS when it was designed. So strictly speaking, image is not a packaged file like an ISO. Image is just a virtual concept. It is not composed of a single file, but a group of file systems, or a combination of multi-layers file systems.
镜像构建时会一层层构建前一层是后一层的基础每一层构建完就不会再发生改变后一层上的任何改变只发生在自己这一层比如删除前一层文件的操作实际不是真的删除前一层的文件而是仅在当前层标记为该文件已删除在最终容器运行的时候虽然不会看到这个文件但是实际上该文件会一直跟随镜像因此在构建镜像的时候需要额外小心每一层尽量只包含该层需要添加的东西任何额外的东西应该在该层构建结束前清理掉
When build an image, it builds layer by layer, and the former is the base of the latter. Once each layer is built, it will not change later. Any change on the latter layer will only occur on its own level. For example, deleting the previous layer of files is not really deleting the files, but only marked as deleted in the current layter. When the final conatiner runs, you won't see the file, but in fact the file will always follow the image. Therefore, take more care when building the image, and any additional things should be cleared up before the end of the layer's construction.
分层存储的特征还使得镜像的复用定制变的更为容易甚至可以用之前构建好的镜像作为基础层然后进一步添加新的层以定制自己所需的内容构建新的镜像
Layered storage features also make it easier to reuse and customize image. You can even use the previously built image as the base layer, and then add a new layer to customize the content you need to build a new image.
关于镜像构建将会在后续相关章节中做进一步的讲解
As for image building, further explanations will be given in subsequent relevant chapters.