简体   繁体   English

为什么要使用私有 Docker Registry?

[英]Why Use a Private Docker Registry?

Why would someone use a private docker registry when they could just share their dockerfile's in source control and have docker image consumers build directly from the dockerfile with docker build ?为什么要使用一个私人码头工人注册表时,他们可能只是分享他们dockerfile的源代码控制,并有搬运工人图像消费者直接与dockerfile建立docker build

To my untrained eye the private docker registry seems to serve the same purpose as source control except it adds complexity because it's been decoupled from the branch of code that you're in and so you (or your CI/CD server more to the point) has to reconstruct which tag to pull.在我未经训练的眼睛看来,私有 docker 注册表似乎与源代码控制具有相同的目的,只是它增加了复杂性,因为它已与您所在的代码分支分离,因此您(或您的 CI/CD 服务器更重要)必须重建要拉哪个标签。

When you deploy on real machines (say you have a job that deploys on 10 machines), usually you don't really want to rebuild the image over and over again.当你在真实机器上部署时(假设你有一个部署在 10 台机器上的工作),通常你真的不想一遍又一遍地重建镜像。

Instead you can build image once, store it somewhere (???) then maybe deploy on test environment, run some tests, make sure its a good image indeed (starts, tests pass, etc) and then deploy on production.相反,您可以构建一次映像,将其存储在某个地方 (???),然后可能会部署在测试环境中,运行一些测试,确保其确实是一个良好的映像(启动、测试通过等),然后部署到生产环境中。

So this "somewhere" means that you should have some registry, and if you don't want to use docker hub - you can use private docker registry.所以这个“某处”意味着你应该有一些注册表,如果你不想使用 docker hub - 你可以使用私有 docker 注册表。

This makes sense from both security (don't publish on cloud if you don't need to) and performance (moving images between servers in private network is faster).这从安全性(如果不需要,请不要在云上发布)和性能(在专用网络中的服务器之间移动图像更快)都有意义。

If you're running kubernetes you can also configure it to pull the images from the docker registry and run pods based on these images as specified in the kubernetes deployment files.如果您正在运行 kubernetes,您还可以将其配置为从 docker 注册表中提取图像,并根据 kubernetes 部署文件中指定的这些图像运行 pod。

If you're running on AWS you can use docker registry to run services like Fargate or ECS.如果您在 AWS 上运行,则可以使用 docker 注册表来运行 Fargate 或 ECS 等服务。 They will take care of scaling out across machines (pretty much like k8s does) but they still need to take the images from somewhere, well, its a private registry (in this case in the cloud called ECS - Elasctic Container Registry).他们将负责跨机器扩展(与 k8s 非常相似),但他们仍然需要从某个地方获取映像,嗯,它是一个私有注册表(在这种情况下,在称为 ECS - Elastic Container Registry 的云中)。

Bottom line, in many (simple) cases you can live without it, but in some other cases it comes pretty handy最重要的是,在许多(简单)情况下,没有它你也可以生活,但在其他一些情况下,它非常方便

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM