amazon-web-services - 我如何使用 ecr 与来自其他注册表的正常 docker 登录

标签 amazon-web-services docker gitlab

我想用普通 docker login对于正常的东西,但对于 ecr,我想使用教程中提到的 credHelpers

https://docs.docker.com/engine/reference/commandline/login/#credential-helpers

但看起来它告诉我替换整个文件

~/.docker/config.json 与

{
"credHelpers": {
                "aws_account_id.dkr.ecr.region.amazonaws.com": "ecr-login"
        }

}

但我的文件已经有这个 connetnt,我不想破坏东西
{
        "auths": {
                "registry.gitlab.com": {
                        "auth": "fdfdfdfdfd"
                }
        }
}

我可以做类似的事情吗
{
        "auths": {
                "registry.gitlab.com": {
                        "auth": "fdfdfdfdfd"
                }
        },


"credHelpers": {
                "dfdfdfdfd.dkr.ecr.region.amazonaws.com": "ecr-login"
        }

}

最佳答案

Configuration files 中所见,事实并非如此:您可以同时拥有 credHelper 和登录信息(不在同一个域中)

所以你可以做你想做的,可能会手动将你的 credHelper 信息添加到配置文件中。

Issue 41提到:

I've been able to get credsStore to work fine, with the addition of auths


{
  "auths" : {
    "registry.gitlab.com": { "auth": "fdfdfdfdfd" },
    "[aws_account_id].dkr.ecr.[region].amazonaws.com" : {}
  },
  "credsStore" : "ecr-login"
}

所以你可以在auths中列出带有凭据或没有凭据的 URL(空 {})。后者将由凭证助手管理(如 awslabs/amazon-ecr-credential-helper )

imdibiji报告,in the comments ,必须使用以下格式来避免:
error: ERRO[0000] Error parsing the serverURL 
error="docker-credential-ecr-login can only be used with 
       Amazon Elastic Container Registry." 
serverURL="index.docker.io/v1" 

格式:
{
  "auths": {
     "index.docker.io/v1": {"auth": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" } }, 
   "credHelpers": { "XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com": "ecr-login" }
}

关于amazon-web-services - 我如何使用 ecr 与来自其他注册表的正常 docker 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49932911/

相关文章:

sql - 在 Amazon Redshift 上获取字符串中的最后一个单词

node.js - 如何在 API Gateway AWS 的 Lambda/Node JS 中添加 CORS header

python - 使用 python 的 sigv4-post-example

azure - VSTS 将 docker-compose 推送到 Azure 容器注册表和 WebApp

docker - 跨 docker pod 的 Spring Boot Controller 重定向

python - Docker 容器无法连接到本地主机上运行的服务器

mysql - Gitlab-CI : Test Job is failing

amazon-web-services - 无法使用 Golang 生成亚马逊产品 API 签名

amazon-web-services - 如何查看在 AWS ELB 后面运行的 SSH 服务器的 SSH 客户端的真实 IP

git - 如何在 GitLab 中创建发布?