docker ps - show image ID instead of name

I found that docker inspect <container-id> can be used for this purpose. It displays an image field containing full hash.


You can pass multiple container-ids to the docker inspect command and then use the --format to only get the values that you want.

docker inspect --format='{{.Id}} {{.Name}} {{.Image}}' $(docker ps -aq)

This will give you a list of the docker container Ids, names and image IDs that are being used for all of your containers.

asdf1234 /mydockercontainer sha256:abcd1234

https://docs.docker.com/engine/reference/commandline/inspect/