英文:
how to list image tags using aws cli on windows
问题
I'm trying to list the image tags from ECR repo using the following command on Windows:
aws ecr list-images --repository-name plat | jq '.imageIds | map(.imageTag) | sort | .[]' | sort -r | head -1
I installed the jq utility; however, it says 'map' is not recognized as an internal or external command.
I tried a lot to find the map utility for Windows but did not succeed. How can I make this entire command work on Windows? It worked perfectly on Linux.
Is there any workaround? Do we have any equivalent command on Windows? Please suggest.
UPDATE 1
On Windows
C:\Users\ik\Downloads>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:\Users\ik\Downloads>
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:\Users\ik\Downloads> 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:\Users\ik\Downloads>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:\Users\ik\Downloads>
英文:
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:\Users\ik\Downloads>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:\Users\ik\Downloads>
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:\Users\ik\Downloads> 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:\Users\ik\Downloads>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:\Users\ik\Downloads>
答案1
得分: 0
使用AWS CLI的内置--query
参数。这是您需要的命令:
aws ecr list-images --repository-name plat --query 'imageIds[].imageTag' --output text
英文:
Use the built in --query
parameter of AWS cli. So this is what you need:
aws ecr list-images --repository-name plat --query 'imageIds[].imageTag' --output text
答案2
得分: 0
以下是您要翻译的内容:
在Windows上的命令如下:
对于Windows:
powershell.exe aws ecr list-images --repository-name <repo-name> | jq '.imageIds | map (.imageTag) | sort | reverse | first'
在此处也提到了相同的内容:
https://eduwebmonster.com/how-to-list-aws-ecr-images-with-latest-tag-on-windows-and-linux/
英文:
here is the command on windows
For Windows :
powershell.exe aws ecr list-images --repository-name <repo-name> | jq '.imageIds | map (.imageTag) | sort | reverse | first'"
same is mentioned here
https://eduwebmonster.com/how-to-list-aws-ecr-images-with-latest-tag-on-windows-and-linux/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论