Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the CMD command of a docker image?

Tags:

docker

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

like image 336
Tal Avatar asked May 25 '15 14:05

Tal


People also ask

What is CMD command in Docker?

The CMD command​ specifies the instruction that is to be executed when a Docker container starts.

How can I see Docker commands?

To list available commands, either run docker with no parameters or execute docker help : $ docker Usage: docker [OPTIONS] COMMAND [ARG...]

Which command is used to see the details of an image in Docker?

docker inspect This command is used see the details of an image or container.

How do I open the Docker container in CMD?

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"


1 Answers

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

like image 180
VonC Avatar answered Sep 23 '22 08:09

VonC