Skip to main content

Pull Docker Image from ECR

Install AWS CLI

For linux 64-bit:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

For another OS: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

Add Credential File

Create credential file on ~/.aws/config

[default]
aws_access_key_id=xxxxxxxxxxxx
aws_secret_access_key=xxxxxxxxxxxxx
region=ap-southeast-1

change ap-southeast-1 with your ECR_REGION

Login to ECR

aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 123456.dkr.ecr.ap-southeast-1.amazonaws.com

change 123456.dkr.ecr.ap-southeast-1.amazonaws.com with your ECR_HOST change ap-southeast-1 with your ECR_REGION

Pull Docker Image

docker pull 123456.dkr.ecr.ap-southeast-1.amazonaws.com/image-name

change 123456.dkr.ecr.ap-southeast-1.amazonaws.com/image-name with your IMAGE_URL