At times , there are cases where we need to get the latest image tag from ECR for one of the repository.
I spend lot of time to figure out how it would be done on Windows and Linux and here is the entire command .
For Windows :
powershell.exe aws ecr list-images --repository-name <repo-name> | jq '.imageIds | map (.imageTag) | sort | reverse | first'"
For Linux:
aws ecr list-images --repository-name <repo-name> | jq '.imageIds | map (.imageTag)|sort|.[]' | sort -r | head -1
Hope you find it useful. Thanks
This has certainly made our jobs a easier. Thank you for creating this content and spreading the beneficial knowledge.
Continue contributing to the IT world and the world at large.