aws机器登录ecr镜像仓库
说明:ECR 使用 AWS 特有的身份验证机制,需要先通过 AWS CLI 获取一个有效期为12小时的临时密码,然后用这个密码去登录,不能直接使用 docker login
1、检查并配置 AWS 凭证
[root@subotiz-stg-kubectl ~]# cat ~/.aws/credentials [default] aws_access_key_id = AKIAUEZPILHR6TL3F5GC aws_secret_access_key = 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
2、使用正确的命令获取密码并登录
[root@subotiz-stg-kubectl ~]# aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 285177567715.dkr.ecr.ap-southeast-1.amazonaws.com WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
3、验证登录并重试推送
docker push 285177567715.dkr.ecr.ap-southeast-1.amazonaws.com/shoplaza-publish/aiops:v26.0.8
如果遇到报错存储库不存在,则创建
[root@subotiz-stg-kubectl ~]# docker push 285177567715.dkr.ecr.ap-southeast-1.amazonaws.com/shoplaza-publish/aiops:v26.0.8 The push refers to repository [285177567715.dkr.ecr.ap-southeast-1.amazonaws.com/shoplaza-publish/aiops] 51998e4512f6: Preparing 1b00f17cf2a2: Preparing d93bacdf61b3: Preparing 5535fda0356b: Preparing name unknown: The repository with name 'shoplaza-publish/aiops' does not exist in the registry with id '285177567715'
aws ecr create-repository \ --repository-name shoplaza-publish/aiops \ --region ap-southeast-1

浙公网安备 33010602011771号