本文介绍了Docker推送到AWS ECR私有存储库,但JSON格式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试用AWS ECR并将新标签推入我们的私人仓库.

I am trying out AWS ECR and pushing a new tag to our private repossitory.

它是这样的:

export DOCKER_REGISTRY=0123123123123.dkr.ecr.us-east-1.amazonaws.com
export TAG=0.1
docker build -t vendor/app-name .
`aws ecr get-login --region us-east-1`" # generates docker login
docker tag vendor/app-name $DOCKER_REGISTRY/vendor/app-name:$TAG
docker push $DOCKER_REGISTRY/vendor/app-name:$TAG

登录有效,创建了标签,并通过docker images看到了它,但推送失败,失败.

Login works, the tag is created and I see it with docker images, but the push fails cryptically.

The push refers to a repository [0123123123123.dkr.ecr.us-east-1.amazonaws.com/vendor/app-name] (len: 2)
b1a1d76b9e52: Pushing [==================================================>]     32 B/32 B
Error parsing HTTP response: unexpected end of JSON input: ""

这很可能是一个错误的配置,但是我不知道如何从中获得更多的输出.该命令没有调试级别选项,没有其他日志,并且由于似乎已加密,所以我无法拦截网络流量.

It very well might be a misconfiguration, but I can't figure out how to get more output out of it. The command has no debug level options, there are no other logs and I can't intercept network traffic since it seems encrypted.

推荐答案

遇到同样的问题.对我来说,请确保我按ecr:BatchCheckLayerAvailability权限进行推送的IAM用户已清除此问题.

Ran into the same issue. For me, ensuring that the IAM user I was pushing as had the ecr:BatchCheckLayerAvailability permission cleared this up.

我原本打算采用仅推送"策略,但没有意识到要成功推送该权限是必需的.

I had originally intended to have a "push-only" policy and didn't realize this permission was required to push successfully.

这篇关于Docker推送到AWS ECR私有存储库,但JSON格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 01:44