在使用Docker时,我们从一个基本映像开始。我们启动它,创建更改,这些更改被保存在图层中形成另一个图像。
因此,最终我为我的PostgreSQL实例和我的web应用程序提供了一个图像,对这些图像的更改将持续保存。
什么是容器?
在使用Docker时,我们从一个基本映像开始。我们启动它,创建更改,这些更改被保存在图层中形成另一个图像。
因此,最终我为我的PostgreSQL实例和我的web应用程序提供了一个图像,对这些图像的更改将持续保存。
什么是容器?
当前回答
在编程方面,
图片是源代码。
当编译和构建源代码时,它被称为应用程序。
类似于“当为映像创建实例时”,它被称为“容器”。
其他回答
Docker的核心概念是使创建“机器”变得容易,在这种情况下,机器可以被认为是容器。容器有助于重用性,允许您轻松地创建和删除容器。
图像描述了容器在每个时间点上的状态。所以基本的工作流程是:
创建映像 启动容器 对容器进行更改 将容器重新保存为图像
映像的实例称为容器。你有一个图像,它是你描述的一组图层。如果启动这个映像,就有了这个映像的运行容器。同一个映像可以有多个正在运行的容器。
你可以用docker images看到你所有的图像,而你可以用docker ps看到你正在运行的容器(你可以用docker ps -a看到所有的容器)。
因此,映像的运行实例就是一个容器。
在编程方面,
图片是源代码。
当编译和构建源代码时,它被称为应用程序。
类似于“当为映像创建实例时”,它被称为“容器”。
I would like to fill the missing part here between docker images and containers. Docker uses a union file system (UFS) for containers, which allows multiple filesystems to be mounted in a hierarchy and to appear as a single filesystem. The filesystem from the image has been mounted as a read-only layer, and any changes to the running container are made to a read-write layer mounted on top of this. Because of this, Docker only has to look at the topmost read-write layer to find the changes made to the running system.
Docker容器正在运行一个映像的实例。你可以将图像与程序关联起来,将容器与进程关联起来:)