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