Im trying to list the image tags from ECR repo using below command on windows
aws ecr list-images --repository-name plat | jq '.imageIds | map (.imageTag) | sort | .[]' | sort -r | head -1
I installed jq utility , however , it says 'map' is not recognized as an internal or external command,
i tried lot finding map utility for windows but did not get . how can I make this entire command work on windows ? it worked perfectly on linux.
any workaround ?
do we have any equivalent command on windows ? please suggest
UPDATE 1
on windows
C:UsersikDownloads>aws ecr list-images --repository-name plat | jq '.imageIds | map (.imageTag) | sort | .[]' | sort -r | head -1
'map' is not recognized as an internal or external command,
operable program or batch file.
PS C:UsersikDownloads>
on linux
root@CSX-Ik:~# aws ecr list-images --repository-name plat | jq '.imageIds | map (.imageTag)|sort|.[]' | sort -r | head -1
"19617.1"
root@CSX-Ik:~#
UPDATE 2
PS C:UsersikDownloads> aws ecr list-images --repository-name plat
{
"imageIds": [
{
"imageDigest": "sha256:5fd06c0b6c6349324343232432429e8bf6b1ce62d810c2eef1eca",
"imageTag": "20230421.001"
},
{
"imageDigest": "sha256:d7a28e9e62c5465465465469080eeae6a8308c99ec032a845119202f6d427ef8",
"imageTag": "33345.1"
},
{
"imageDigest": "sha256:681ae17a52a4c673cc8c62d50823432432432432432432497789879c37a4",
"imageTag": "3445.2"
},
{
"imageDigest": "sha256:ff7090d214ac72334323243209809809803e8af",
"imageTag": "33456.1"
}
}
]
}
after putting map equivalent
C:UsersikDownloads>aws ecr list-images --repository-name plat | jq '.imageIds | [.[] | .imageTag] | sort | .[]' | sort -r | head -1
'[.[]' is not recognized as an internal or external command,
operable program or batch file.
PS C:UsersikDownloads>
2
Answers
here is the command on windows
For Windows :
same is mentioned here
https://eduwebmonster.com/how-to-list-aws-ecr-images-with-latest-tag-on-windows-and-linux/
Use the built in
--query
parameter of AWS cli. So this is what you need: