I am pushing docker image in AWS ECR using Jenkins.
While pushing the image i am providing tag as $Build_Number.So in ECR repo i have images with tags like 1,2,3,4.
But when i am trying to pull the image from EC2 with below command from Jenkins job
docker pull 944XXX.dkr.ecr.us-east-1.amazonaws.com/repository1:latest
I am getting error as there is no image with tag as latest.
Here i want to pull the latest image (with tag 4).I cannot hard-code tag number here as docker pull command will run from Jenkins job automatically.So what way i can pull the latest image ?