liveBook · Manning

Cmd directive

The Dockerfile CMD instruction specifies the default command or arguments executed when a container starts, unless overridden at runtime.

How 2 Manning books explain it

Road to Kubernetes

CMD is a Dockerfile instruction that specifies the default command for a container when it starts.

How it is used
Configures the command a container uses by default when it starts.
How deep it goes
Explains direct commands and entrypoint scripts, stopping short of detailed ENTRYPOINT behavior.
Examples
Uses NGINX, Python with Gunicorn, and Node.js applications launched through shell scripts.
What you can do after
Builds Dockerfiles that start web applications directly or through configurable entrypoint scripts.

Read how Road to Kubernetes explains cmd directive →

Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A container image build directive that specifies the default command or arguments for a container.

How it is used
Defines the default command used when Podman launches an image without an explicit command.
How deep it goes
Explains defaulting, parent-image inheritance, and the distinction between build-time RUN and launch-time CMD.
Examples
Uses CMD /usr/bin/start.sh as a default startup command.
What you can do after
Apply CMD in a Containerfile to define an image's default Podman startup command.

Read how Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more explains cmd directive →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.