Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list Docker images for arm64?

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.

like image 401
Olivier Refalo Avatar asked Jan 21 '26 00:01

Olivier Refalo


2 Answers

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 command
  • docker image inspect print detailed info about image
    • --format "{{.ID}} {{.RepoTags}} {{.Architecture}}" → print only necessary data instead of full JSON

Also it is possible to add pipe with grep, like {inspect command} | egrep 'amd64$' to print only amd64 architecture for example.

like image 88
rzlvmp Avatar answered Jan 23 '26 17:01

rzlvmp


Try to combine docker image with jq :

docker image inspect \
    $(docker images -q) \
    | jq -r '.[] | select(.Architecture=="arm64").RepoTags[]'
like image 23
Philippe Avatar answered Jan 23 '26 16:01

Philippe