How to find the CMD command of a docker image?

Solution 1:

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".

Solution 2:

If it's running, you can use

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

Shamlessley pulled from this response