将 docker 镜像推送到亚马逊 ecs 存储库 [英] Push docker image to amazon ecs repository

查看:33
本文介绍了将 docker 镜像推送到亚马逊 ecs 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 AWS 新手.我想在 AWS ECS 容器实例上设置一个私有 docker 存储库.我创建了一个名为 name 的存储库.AWS 显示的示例推送命令正在运行.

Im new to AWS. I want to set up a private docker repository on an AWS ECS container instance. I created a repository named name. The example push commands shown by AWS are working.

aws ecr get-login --region us-west-2 
docker build -t name .
docker tag name:latest ############.dkr.ecr.us-west-2.amazonaws.com/name:latest 
docker push ############.dkr.ecr.us-west-2.amazonaws.com/name:latest

但是通过这些命令,我​​构建并推送了一个名为 name 的图像,并且我想构建一个名为 foo 的图像.所以我将命令更改为:

But with this commands I build and pushed an image named name and I want to build an image named foo. So I altered the commands to:

docker build -t foo .
docker tag foo ###########.dkr.ecr.us-west-2.amazonaws.com/name/foo
docker push ###########.dkr.ecr.us-west-2.amazonaws.com/name/foo

这应该有效,但它没有.经过一段时间的重试后,我得到了错误:

This should work, but it doesn't. After a period of retrys I get the error:

The push refers to a repository [###########.dkr.ecr.us-west-2.amazonaws.com/name/foo]
8cc63cf4528f: Retrying in 1 second
...
name unknown: The repository with name 'name/foo' does not exist in the registry with id '############'

AWS 是否真的需要为我要推送的每张图片使用一个专用存储库?

Does AWS really require a dedicated repository for every image i want to push?

推荐答案

EC2 容器注册表 需要 映像存储库 为要发布到注册表的每个图像名称"或名称空间/名称"进行设置.

The EC2 Container Registry requires an image Repository to be setup for each image "name" or "namespace/name" you want to publish to the registry.

您可以在每个存储库中发布您想要的任何 :tags(默认限制为 100 个标签).

You can publish any :tags you want in each Repository though (The default limit is 100 tags).

我在 AWS 文档中没有看到任何地方专门说明存储库 -> 图像名称映射,但 创建存储库 - ECR 用户指南中的第 6d 节

I haven't seen anywhere in the AWS documentation that specifically states the repository -> image name mapping but it's implied by Creating a Repository - Section 6d in the ECR User Guide

Docker Image 规范包括存储库的定义

存储库

在一个公共前缀(: 之前的名称组件)下分组的标签集合.例如,在带有名称标记的图像中my-app:3.1.4,my-app 是Repository 组件的名字.一个存储库名称由斜杠分隔的名称组成,可选地以 DNS 主机名作为前缀.主机名必须符合标准 DNS 规则,但不能包含 _ 字符.如果主机名是存在,它可以可选地后跟一个端口号,格式为:8080.名称组件可能包含小写字符、数字和分隔符.分隔符定义为句点,一个或两个下划线或一个或多个破折号.名称组件可能无法启动或以分隔符结尾.

A collection of tags grouped under a common prefix (the name component before :). For example, in an image tagged with the name my-app:3.1.4, my-app is the Repository component of the name. A repository name is made up of slash-separated name components, optionally prefixed by a DNS hostname. The hostname must comply with standard DNS rules, but may not contain _ characters. If a hostname is present, it may optionally be followed by a port number in the format :8080. Name components may contain lowercase characters, digits, and separators. A separator is defined as a period, one or two underscores, or one or more dashes. A name component may not start or end with a separator.

这篇关于将 docker 镜像推送到亚马逊 ecs 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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