简体   繁体   English

package 和容器有什么区别?

[英]What is the difference between a package and container?

GitHub recently released a container registry alongside their package registry. GitHub 最近与他们的 package 注册表一起发布了一个容器注册表。 What is the difference?有什么不同? When would it be better to use one or the other?什么时候使用一个或另一个更好? Do we need both?我们都需要吗?

Packages are generally simple: they are essentially an archive (ie zip file) that contains contents (code libraries, application executables, etc.) and a manifest file (json document, xml file, etc) that describes those contents with a package name and version number (at a minimum).包通常很简单:它们本质上是一个存档(即 zip 文件),其中包含内容(代码库、应用程序可执行文件等)和一个清单文件(json 文档、xml 文件等),该清单文件用 package 名称和 package 描述这些内容版本号(至少)。 ie:- npm,pip and composer packages.即:- npm,pip 和作曲家包。

Container images are also simple, but they're more like an archive (ie a zip file) than a package. ie:- nginx, redis etc容器镜像也很简单,但它们更像是一个存档(即 zip 文件)而不是 package。即:- nginx、redis 等

Verdict:- if some libs repetitively used in any project then we can create package and use in project.while for all project based dependencies we need to choose container to run this.判决:- 如果某些库在任何项目中重复使用,那么我们可以创建 package 并在项目中使用。而对于所有基于项目的依赖项,我们需要选择容器来运行它。 Yes we need both.是的,我们两者都需要。

After debating this with a Docker-using friend for a while I think I've found a satisfactory explanation:在与一位使用 Docker 的朋友讨论了一段时间后,我想我找到了一个令人满意的解释:

  • Packages are for modules of code which are compiled together into an Application.包用于代码模块,这些代码模块一起编译成一个应用程序。
  • Containers are for Applications which are compiled together into a Server.容器用于一起编译到服务器中的应用程序。

This is a bit confused by the fact that a Package can contain a standalone Applications, and Containers will often use package managers like Apt to install these applications.这有点令人困惑,因为一个 Package 可以包含一个独立的应用程序,而容器通常会使用像 Apt 这样的 package 管理器来安装这些应用程序。 I feel like this is an abuse of package management due to a legacy where we didn't have Containers.我觉得这是对 package 管理的滥用,因为我们没有容器。 Eventually I would expect most Applications will be delivered in Container form.最终我希望大多数应用程序将以容器形式交付。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 容器和半虚拟化有什么区别? - What is the difference between Container and Paravirtualization? Kubernetes 中的驱动程序和容器运行时有什么区别? - What is the difference between Drivers and Container Runtimes in Kubernetes? Docker容器和Ansible Playbook有什么区别? - What is the difference between a Docker Container and an Ansible Playbook? Docker 服务和 Docker 容器有什么区别? - What is the difference between Docker Service and Docker Container? Docker Host和Container之间有什么区别 - What is the difference between Docker Host and Container Web容器和docker有什么区别? - What is the difference between a web container and docker? Docker 镜像和容器有什么区别? - What is the difference between a Docker image and a container? Docker中的容器层和卷之间有什么区别? - What is the difference between container layer and volume in Docker? “停止”和“退出”的容器有什么区别? - What's the difference between a “stopped” and an “exited” container? Azure 容器实例和容器的 Web 应用程序之间有什么区别? - What is the difference between Azure Container Instances and Web App for Containers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM