brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: docker buildx imagetools inspect shows which platforms an image supports

Docker
~/tips/tip-docker-buildx-imagetools-inspect

docker buildx imagetools inspect alpine

Lists the CPU platforms of a container image before you pull it.

Before I pull an image onto a Raspberry Pi or an ARM box, I want to know if there is an ARM build at all. You can find that out without pulling anything.

docker buildx imagetools inspect alpine

For a multi-arch image you get the manifest list at the top and then one entry per image, each with a Platform: line such as linux/amd64, linux/arm64/v8 or linux/386. If linux/arm64 is missing, the image will not run natively on that Pi, and you know before the pull fails or falls back to emulation.

I use two flags with it. --raw prints the original manifest JSON, so you can pipe it into jq:

docker buildx imagetools inspect --raw alpine | jq

And --format takes a Go template. The Docker docs show how to get the details of one platform:

docker buildx imagetools inspect --format '{{json (index .Image "linux/arm64/v8")}}' alpine

That gives you the image config for just that platform, which is handy when you want to compare what is inside the ARM and x86 versions.

Caveat: it reads from the registry, so private images need a docker login first, and you need the buildx plugin installed. If docker buildx is an unknown command, that plugin is missing.

Further reading: docker buildx imagetools inspect reference, On this site: docker top lists the processes inside a container

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link