Location:Home >> News >> 移动

解释 docker 镜像与容器之间的区别

解释 docker 镜像与容器之间的区别

Docker 允许开发人员快速启动任何开发环境,而无需在其本地计算机上安装所有必需的软件和工具。这是使用图像和容器完成的,但这意味着什么?今天,我将解释 docker 镜像与容器之间的区别。

什么是 Docker 镜像?

镜像是包含创建容器所需信息的包。它包括在容器运行时使用的所有依赖项和部署配置。图像可以使用分层从多个基础图像继承。我们将在本课程中深入讨论这个主题,您将构建基础镜像并使用构建器模式和多阶段构建。层层叠叠形成容器的文件系统。图像没有状态,它永远不会改变。

如果您在本地开发环境中工作,要开始任何项目,您的第一步通常是安装您正在处理的项目所需的一切,例如 SQL 服务器、IIS、搜索索引提供程序(如 Solr)等。此过程容易出错且乏味。

Docker 镜像包含所有这些工具,这意味着当您开始一个新项目时,团队中的开发人员只需拉取 docker 镜像!老实说,这是有史以来最好的事情。

什么是 Docker 容器?

另一方面,容器是图像的运行时实例。它具有图像、执行环境和运行时说明,例如执行 nuget 还原和使用 MSBuild 构建解决方案。

Docker 背后的想法是它定义了一个标准来运送软件。集装箱是指海运集装箱,它定义了在全球范围内运输货物的标准。这些货物到达码头,码头工人(也称为码头工人)是从集装箱装卸货物的人。在我听到这个消息之前,我已经使用 Docker 工作了一年多,我想把它传递下去!让我们在实践中看看这个!

如何拉取 Docker 镜像并运行 Docker 容器

我将使用静态站点示例。您可以使用此处显示的运行命令从 docker-curriculum 存储库中获取它。我在 VSCode 中使用 Docker 扩展来处理 Docker 图像和容器,我强烈推荐它。

Special Reminder & Disclaimer:
The information of this website comes from the Internet. The content (pictures, videos and words) released by this website is mainly the content submitted by users and reproduced by users. The purpose is to convey more information, which does not mean that this website agrees with its views. The originality, statements, and content of this article have not been verified by this website. We do not guarantee or promise the authenticity, completeness, or timeliness of this article or all or part of its content or text. Please verify the relevant content on your own. This website does not assume direct or joint liability for infringement of such works. If any content on this website infringes on your rights, please contact us promptly (email: nssa@soufind.com )This site will complete the processing within 72 hours. The original content on this website cannot be reproduced without permission, or the source must be indicated when reprinting: nssa.vip Aerospace Alliance

Author:

Recommended for you

Post comments

admin

Contact Us

Contact Us

Online consultation: QQ交谈

Email: service#soufind.com

follow us on WeChat
Scan and follow us on WeChat

Scan and follow us on WeChat