How to find the CMD command of a docker image?

后端 未结 2 685
抹茶落季
抹茶落季 2021-02-05 00:52

I have a docker image installed and I\'d like to check what is its CMD command. Is there any cli command to do so? for example, I\'d like it to tell me that this docker image CM

相关标签:
2条回答
  • 2021-02-05 01:34

    You can use the docker inspect command

    docker inspect --format='{{.Config.Cmd}}' <image:tag>
    docker inspect -f '{{.Config.Cmd}}' <image:tag>
    

    That is used, for instance, to "list full command of running/stopped container in Docker".

    0 讨论(0)
  • 2021-02-05 01:43

    If it's running, you can use

    docker inspect -f "{{.Path}} {{.Args}} ({{.Id}})" $(docker ps -a -q)

    Shamlessley pulled from this response

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