7

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
Ryan Fisher
  • 1,485
  • 1
  • 19
  • 32

2 Answers2

9

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
Naveen Reddy Marthala
  • 2,622
  • 4
  • 35
  • 67
3

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:

  1. Log in ECR

$(aws ecr get-login --no-include-email --registry-ids 520713654638 --region us-west-2)

  1. Pull the image

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.

yay1
  • 156
  • 4
  • That was it, was following this doc and it doesn't mention the `--registry-ids` option (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html). The ECR repo doesn't have a `latest` tag, any idea how I can figure out what tags are available? – Ryan Fisher May 06 '19 at 20:54
  • Never mind, I found it in their repo. It's currently `0.20.0-cpu-py3` (https://github.com/aws/sagemaker-scikit-learn-container/blob/master/ci/buildspec.yml). Thanks for making your documentation a labyrinth as always AWS! – Ryan Fisher May 06 '19 at 21:01