Docker图像与容器 [英] Docker image vs container

查看:165
本文介绍了Docker图像与容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker的图像和容器如何不同?



当使用docker时,我们从基础图像开始。我们启动它,创建更改,这些更改保存在形成另一个图像的图层中。



所以最终我有一个图像为我的Postgres和一个图像为我的网络应用程序的变化,继续保持。



所以问题是:什么是容器?

解决方案

图像的一个实例称为容器。你有一个图像,它是一组你所描述的图层。如果你启动这个图像,你有一个这个图像的运行容器。您可以拥有相同图像的许多运行容器。



您可以使用 docker图像查看所有图像,而您可以使用 docker ps (您可以看到所有带有 docker ps -a 的容器) p>

所以运行的图像是一个容器。


How are Docker images and containers different?

When using docker, we start with a base image. We boot it up, create changes and those changes are saved in layers forming another image.

So eventually I have an image for my Postgres and an image for my web app, changes to which keep on being persisted.

So the question is: what is a container?

解决方案

An instance of an image is called a container. You have an image, which is a set of layers as you describe. If you start this image, you have a running container of this image. You can have many running containers of the same image.

You can see all your images with docker images whereas you can see your running containers with docker ps (and you can see all containers with docker ps -a).

So a running image is a container.

这篇关于Docker图像与容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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