Docker image tagging in ECR

AWS provides a docker repository called ECR. This is similar to Docker Hub, Artifactory etc and provides a convenient place to place docker images for later use e.g. deployment.

ECR supports Docker Image Manifest V2, Schema 2, providing the ability to add multiple tags per image. I recently ran into an issue wherein I tagged an image with multiple tags at build time and then just pushed one tag, thinking all tags would appear on ECR. That did not work and my image in ECR always had only one tag. To ensure that your image has all the tags on ECR, push each tag individually.

docker tag tag1 imageName
docker tag tag2 imageName
docker tag tag3 imageName
docker push tag1
docker push tag2
docker push tag3