为什么您需要使用Docker的基本映像? [英] Why do you need a base image with Docker?

查看:68
本文介绍了为什么您需要使用Docker的基本映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了 Docker 文档的每一页。

I have went through every single page of the documentation of Docker.

我仍然不明白,为什么在安装/创建应用程序之前需要基本映像(例如,Ubuntu基本映像)来提供容器环境。

I do not understand, yet still, why a "base image" (for example, the Ubuntu Base Image) is necessary to furnish the containers before installing/creating an application environment.

我的问题:


  • 什么是基本图像,为什么是

  • 为什么不能仅创建一个容器并将应用程序放入其中,就像Python的virtualenv一样?

推荐答案

实际上, Docker 通过应用添加到基本图像的图层来工作。由于必须在所有这些层之间保持一致性,因此您不能将第一张图片基于移动的目标(即可写文件系统)。因此,您需要一个将永远保持不变的只读图像。

In fact, Docker works through application of layers that are added to the base image. As you have to maintain coherence between all these layers, you cannot base your first image on a moving target (i.e. your writable file-system). So, you need a read-only image that will stay forever the same.

此处是图像<的docker.io/ rel = noreferrer> Docker / a>:


由于Docker使用联合文件系统,因此进程认为整个文件系统都是以读写方式安装的。但是所有更改都进入了最顶层的可写层,并且在下面,只读映像中的原始文件未更改。由于图像不变,所以图像没有状态。

Since Docker uses a Union File System, the processes think the whole file system is mounted read-write. But all the changes go to the top-most writable layer, and underneath, the original file in the read-only image is unchanged. Since images don’t change, images do not have state.

这篇关于为什么您需要使用Docker的基本映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆