docker ps - show image ID instead of name

前端 未结 3 1733
没有蜡笔的小新
没有蜡笔的小新 2021-02-15 06:46

I display running containers using docker ps command. There is an IMAGE column that shows name of the image that each container was create

相关标签:
3条回答
  • 2021-02-15 07:21

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

    0 讨论(0)
  • 2021-02-15 07:23

    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/

    0 讨论(0)
  • 2021-02-15 07:28
    docker images
    

    will show you the image names and their IDs

    0 讨论(0)
提交回复
热议问题