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.
From the command line, how do I 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.
Is this what you looking for?
docker image inspect \
--format "{{.ID}} {{.RepoTags}} {{.Architecture}}" \
$(docker image ls -q)
output:
sha256:fb495265b81ffaa0d3bf8887231b954a1139b2e3d611c3ac3ddeaff72313909c [postgres:10.11-alpine] amd64
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 only amd64
architecture for example.