Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save epankur/574665755c6c208309b65a159f5b6e05 to your computer and use it in GitHub Desktop.
Save epankur/574665755c6c208309b65a159f5b6e05 to your computer and use it in GitHub Desktop.
How to add new tags and remove unwanted tag from AWS ECR Image?
//Get the current manifest of the ECR image ecrimage-800
MANIFEST=$(aws ecr batch-get-image --repository-name ecrimage-800 --image-ids imageTag=latest --query 'images[].imageManifest' --output text)
echo $MANIFEST | jq '.'
//Push the tag called newtag along with image manifest.
aws ecr put-image --repository-name ecrimage-800 --image-tag newtag --image-manifest "$MANIFEST"
//Now ecrimage-800 will have two tags, "latest" and "newtag". You are ready to remove "latest" tag if you like.
aws ecr batch-delete-image --repository-name ecrimage-800 --image-ids imageTag=latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment