I own a Mac M1 and I run Docker on it.
On OSX, Docker can run native ARM images but also emulate x86/amd64 to run images that were not built for ARM.
My question is simple: From the command line, I am trying to find an extension of the command ‘docker image ls’ which displays the image platform.
$ docker image ls
REPOSITORY TAG PLATFORM IMAGE ID CREATED SIZE
………………………..arm64
………………………..x86
I already saw this answer: How to filter Docker images by platform? but it does NOT answer the question. OS and PLATFORM are two different things.
Thank you
2
Answers
Try to combine
docker image
withjq
:Is this what you looking for?
output:
Explanation:
$(docker image ls -q)
→ pass all image IDs as parameters to inspect commanddocker image inspect
print detailed info about image--format "{{.ID}} {{.RepoTags}} {{.Architecture}}"
→ print only necessary data instead of full JSONAlso it is possible to add pipe with
grep
, like{inspect command} | egrep 'amd64$'
to print onlyamd64
architecture for example