I'm trying to pull one of the Amazon SageMaker Pytorch public images as per this example. In the example they use a shell script and a Dockerfile to pull-expand-build the container and push it to ECR. Here's the shell script:
# The name of our algorithm
algorithm_name=pytorch-extending-our-containers-cifar10-example
cd container
account=$(aws sts get-caller-identity --query Account --output text)
# Get the region defined in the current configuration (default to us-west-2 if none defined)
region=$(aws configure get region)
region=${region:-us-west-2}
fullname="${account}.dkr.ecr.${region}.amazonaws.com/${algorithm_name}:latest"
# If the repository doesn't exist in ECR, create it.
aws ecr describe-repositories --repository-names "${algorithm_name}" > /dev/null 2>&1
if [ $? -ne 0 ]
then
aws ecr create-repository --repository-name "${algorithm_name}" > /dev/null
fi
# Get the login command from ECR and execute it directly
# ( PROBLEM 1 )
$(aws ecr get-login --region ${region} --no-include-email)
# Get the login command from ECR in order to pull down the SageMaker PyTorch image
# ( PROBLEM 2 )
$(aws ecr get-login --registry-ids 520713654638 --region ${region} --no-include-email)
# Build the docker image locally with the image name and then push it to ECR
# with the full name.
docker build -t ${algorithm_name} . --build-arg REGION=${region}
docker tag ${algorithm_name} ${fullname}
docker push ${fullname}
However they use aws ecr get-login to get access to ECR. get-login is now deprecated in favour of get-login-password and running this shell script in awscli 2.0.3. fails. If I understood correctly then the first command (PROBLEM 1) can be replaced with:
$(aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${account}.dkr.ecs.${region}.amazonaws.com)
However the second command requires the flag --registry-ids, which is not recognized by get-login-password. How can I replace this command so that I could docker login to pull one of the SageMaker images from an external ECR registry?