简体   繁体   English

Docker将容器推送到私有注册表

[英]Docker pushing containers to private registry

I have an app which uses several docker containers: 我有一个使用多个Docker容器的应用程序:

  1. NGINX container NGINX容器
  2. NodeJS sails app container NodeJS航行应用程序容器
  3. Redis cache container Redis缓存容器

Since I'm using existing images for two of the above containers, I also have two cached containers: 由于我将现有图像用于上述两个容器,因此我也有两个缓存的容器:

  1. alpine 高山的
  2. redis Redis

I'm trying to push my containers (1, 2, & 3) to AWS Elastic Container Registry (ECR). 我正在尝试将我的容器(1、2和3)推送到AWS Elastic Container Registry(ECR)。 I've been able to do this, but have noticed that my cached containers (4 & 5) get pushed too. 我已经能够做到这一点,但是注意到我的缓存容器(4和5)也被推送了。

I'm building the containers using docker-compose , and then tagging like so: 我正在使用docker-compose构建容器,然后像这样标记:

docker tag -f nodejs_app:latest <repository URL>:latest

After logging into ECR with docker login , I push using this command: 使用docker login登录到ECR之后,我使用以下命令进行推送:

docker push <repository URL>:latest

Docker then pushes all 5 containers up into the registry. 然后,Docker将所有5个容器推入注册表。 How do I only push the containers that I care about and not the cached ones too? 如何只推送我关心的容器,而不推送缓存的容器?

Thanks in advance :-) 提前致谢 :-)

How do I only push the containers that I care about and not the cached ones too? 如何只推送我关心的容器,而不推送缓存的容器?

You don't. 你不知道

Docker images (not containers ; a container is what you get when you boot an image ) are built from layers. Docker映像(不是容器 ;容器是引导映像时获得的容器)是从层构建的。 Your nginx image, for example, consists of all the layers from the alpine image, followed by any layers that are created as the result of your Dockerfile . 例如,您的nginx映像包括alpine映像中的所有层,然后是Dockerfile的结果所创建的任何层。

In order for your new image to be stored in a private repository, all the underlying layers need to be available . 为了将新映像存储在私有存储库中, 所有基础层都必须可用 This means that in addition to the layers you create via your Dockerfile , all the layers from the alpine image also need to be pushed to the repository as well. 这意味着,除了通过Dockerfile创建的图层外, alpine映像中的所有图层也都需要推送到存储库中。

So if you build an image on top of the alpine image and push it to a private repository, the alpine image will get pushed there as well. 因此,如果您在alpine图像上构建图像并将其推送到私有存储库,那么alpine图像也将被推送到那里。

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

相关问题 AWS Sagemaker 中的用户 Docker Hub 注册表容器 - User Docker Hub registry containers in AWS Sagemaker AWS Batch 不适用于私有 docker 注册表 - AWS Batch not working with private docker registry Packer实例访问AWS中的私有Docker注册表 - Packer instance accessing private Docker registry in AWS Docker Private Registry:ping尝试失败 - Docker Private Registry: ping attempt failed Elastic Beanstalk Docker 私有注册表与 docker-compose - Elastic Beanstalk Docker private registry with docker-compose 在 AWS ECS 中使用来自私有外部注册表的 docker 映像 - Use docker image from private external registry in AWS ECS aws ecs优化AMI中的私有docker注册表身份验证不成功 - Private docker registry authentication in aws ecs optimized AMI is not successful 将Amazon ECR注册表作为私有注册表 - Amazon ECR registry as Private registry 如何使用 Pulumi 配置 AWS ECS Fargate 任务/集群以访问私有 Docker 容器注册表(如 GitHub 容器注册表)? - How to configure AWS ECS Fargate Tasks/Cluster to access private Docker Container Registry (like GitHub Container Registry) with Pulumi? 如何使用Amazon ECS从Tutum私有注册表中提取Docker映像? - How do I pull Docker images from the Tutum private registry with Amazon ECS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM