Reputation: 1618
I'm trying to pull the pre-built docker images for SageMaker. I am able to successfully docker login
to ECR (my AWS credentials). When I try to pull the image I get the standard no basic auth credentials
.
Maybe I'm misunderstanding... I assumed those ECR URLs were public.
$(aws ecr get-login --region us-west-2 --no-include-email)
docker pull 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-scikit-learn
Upvotes: 11
Views: 8135
Reputation: 362
This answer is still correct, but I am adding some additional information in hopes that others find it useful:
You would need to login to AWS CLI on your machine, then pipe the password to your docker login like this:
$ sudo aws ecr get-login-password --region <region> | sudo docker login --username AWS --password-stdin <account-id>.dkr.ecr.<region>.amazonaws.com
find the account IDs of the repo in the aws region nearest to you here; and available images with tags here by region.
Once you're logged into ECR for your nearest region, you will need to determine the image name and tag that you want to pull down. The format of the container name and tags are documented here, however it was not obvious to me at first glance.
According to this guide, the format of the Docker image name and tags is as follows:
{account}.dkr.ecr.{region}.amazonaws.com/{framework}:{framework_version}-{processor_type}-{python_version}
In my case, I wanted to pull the pytorch training 2.0.0 CPU image, circled in the documentation below in red:
This means that my final docker pull
command was:
docker pull 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-training:2.0.0-cpu-py310
Upvotes: 0
Reputation: 3123
As of 29th August 2021, get-login
is deprecated and the command in the answer won't work. so, with AWS CLI v2, here's what has worked for me:
You would need to login to AWS CLI on your machine, then pipe the password to your docker login like this:
$ sudo aws ecr get-login-password --region <region> | sudo docker login --username AWS --password-stdin <account-id>.dkr.ecr.<region>.amazonaws.com
find the account IDs of the repo in the aws region nearest to you here; and available images with tags here by region.
Then you should be able pull images like this:
$ sudo docker pull 720646828776.dkr.ecr.ap-south-1.amazonaws.com/sagemaker-scikit-learn:0.23-1-cpu-py3
Upvotes: 13
Reputation: 176
Could you show your ECR login command and pull command in the question?
For SageMaker pre-built image 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-mxnet:1.3.0-cpu-py3
What I do is:
$(aws ecr get-login --no-include-email --registry-ids 520713654638 --region us-west-2)
docker pull 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-mxnet:1.3.0-cpu-py3
These images are public readable so you can pull them from any AWS account. I guess the reason you failed is that you did not specify --registry-ids in your login. But it's better if you can provide your scripts for others to identify what's wrong.
Upvotes: 4