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 CMD is ["rails","server"]
The CMD command specifies the instruction that is to be executed when a Docker container starts.
To list available commands, either run docker with no parameters or execute docker help : $ docker Usage: docker [OPTIONS] COMMAND [ARG...]
docker inspect This command is used see the details of an image or container.
To use the docker exec command, you will need a running Docker container. If you don't already have a container, start a test container with the following docker run command: docker run -d --name container-name alpine watch "date >> /var/log/date. log"
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With