将Docker映像推送到Amazon ECS存储库 [英] Push docker image to amazon ecs repository

查看:179
本文介绍了将Docker映像推送到Amazon 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文档中没有特别说明存储库->映像名称映射的地方,但是

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映像规范包括以下内容: 存储库

存储库

Repository

以公共前缀(:之前的名称组件)分组的标签集合.例如,在标有名称的图像中 my-app:3.1.4,my-app是名称的存储库组件.一种 存储库名称由斜杠分隔的名称组成, (可选)以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映像推送到Amazon ECS存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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