Steps
a. Install Docker Desktop for Windows.
[https://hub.docker.com/editions/community/docker-ce-desktop-windows]
b. Install WSL2.
[https://docs.microsoft.com/en-us/windows/wsl/install-win10]
c. Make sure awscli is up to date.
[https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html]
d. Run the following command to login to the ECR repo.
aws ecr get-login-password --region <aws-region> | docker login --username AWS --password-stdin <ecr-repo-name>
Or if you are using an older awscli, you can try
aws ecr get-login --no-include-email --region <aws-region> > ./run.sh
Then run the shell file — run.sh
e. If you encounter error in step 4 (d) →
"Error saving credentials: error storing credentials - err: exit status 1"
then you need to rename the following exe file.
And also rename ~/.docker/config.json to ~/.docker/config.json.original
Run the shell script run.sh again.
Copy AWS ECR repo between 2 AWS accounts
a. To pull a repo:
docker pull <repo/image>
b. Create the same repo in second account.
aws ecr create-repository — repository-name <repo-name> --profile account2
c. Tag the image and push to target repo.
docker tag <account1-image> <account2-image>
docker push <account2-image>
Top comments (0)