aws ecr new account docker push policy
1. IAM User -> New User -> Demo_ECR
Add Permissions policies 新增許可
a. 直接連接現有政策 AmazonEC2ContainerRegistryPowerUser
b. 建立policies -> Demo_ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/security-iam-awsmanpol.html
2. install aws cli tools windows
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html
3. aws ecr repositories -> private -> create repository
input demo
Keep ooxxooxxooxxooxx.dkr.ecr.ap-northeast-1.amazonaws.com/demo
save
4. aws cli login powershell windows
aws configure
go back IAM, show Demo_ECR -> 安全登入資料 security login
run 建立存取金鑰 create Access Key
copy new Access Key ID and AWS Secret Access Key
back aws configure. Input Access Key ID, Secret Access Key, ap-northeast-1 and Enter
5. docker login
aws ecr get-login-password –region ap-northeast-1
copy return Text like: eyJwYXlsb2FkIjoieE9hcWgzYmdPOXpN……………
6. docker image craete
First check your docker image: docker image ls
REPOSITORY = Image Name.
Tag is import.
Example “demo” is my image that want to send to aws repository.
docker tag “your image name”:“your image” tag “aws repository URI”
docker tag demo:latest ooxxooxxooxxooxx.dkr.ecr.ap-northeast-1.amazonaws.com/demo
check “docker image ls” again
Now you can see new repository: ooxxooxxooxxooxx.dkr.ecr.ap-northeast-1.amazonaws.com/demo
7. docker image push
docker push ooxxooxxooxxooxx.dkr.ecr.ap-northeast-1.amazonaws.com/demo
Finish.
ERROR
Q: error parsing HTTP 403 response body: unexpected end of JSON input: ""
A: When you step 3. Image scan settings:get error If you check true. You can change false then push success.
A. other way.
https://github.com/aws/aws-toolkit-azure-devops/issues/311
go back step 1. change policy.