Docker AWS ECR 错误解析 HTTP 404 响应正文:顶级值后的无效字符 'p':“404 页面不是 found\n”

Docker AWS ECR error parsing HTTP 404 response body: invalid character 'p' after top-level value: "404 page not found\n"

遇到无法从 AWS ECR 注册表推送或拉取的问题,并出现以下神秘错误:

error parsing HTTP 404 response body: invalid character 'p' after top-level value: "404 page not found\n"

几个小时的谷歌搜索表明这是一个协议问题。原来图片名称:

xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/snowshu__test

问题是:当图像名称包含双下划线时出现 AWS ECR 错误。

这与 ECR 命名相矛盾 documentation

正在将图像重命名为

xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/snowshu_test

解决了问题。

存储库名称中不能有两个下划线并排。

根据 Docker Registry API:

A component of a repository name must be at least one lowercase, alpha-numeric characters, optionally separated by periods, dashes or underscores. More strictly, it must match the regular expression [a-z0-9]+(?:[._-][a-z0-9]+)*.