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 compose images lists the images behind your project's containers

Docker
~/tips/tip-docker-compose-images

docker compose images

Shows which images the containers of a Compose project use, as a table, JSON or only IDs.

The Compose file tells me which image I asked for, and I sometimes want to know what a project is really running. This command shows that.

In the project folder:

docker compose images

The Docker docs describe it as listing the images used by the created containers. The usage is docker compose images [OPTIONS] [SERVICE...], so you can name services to narrow the list down. Without a service name, every service of the project is listed.

There are two options. --format takes table, the default, or json, and -q or --quiet prints only the image IDs:

docker compose images --format json
docker compose images -q

It is useful after a docker compose pull to see whether a container still runs on an older image than the one you just fetched, and the JSON output is easy to feed into a script that compares IDs.

For the images on the host as a whole, including ones no container uses any more, docker image ls is the command.

The wording “created containers” matters. A service that has never been created, or whose container was removed, does not show up. If the list looks short, run docker compose up -d first.

Further reading: Docker docs: docker compose images

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