Cmd directive
The Dockerfile CMD instruction specifies the default command or arguments executed when a container starts, unless overridden at runtime.
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.
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.
Related concepts
- containerconfigures · A software container is an isolated execution environment that packages an application and its dependencies while sharing the host operating system kernel.
- Dockerfilepart of · A Dockerfile is a text file containing declarative instructions for building a container image and specifying its contents and runtime metadata.
- entrypoint instructionalternative to · The ENTRYPOINT instruction is a Dockerfile directive that specifies the executable or command run when a container starts.
- npm start commanduses · npm start is an npm command that runs the package manifest’s configured start script.
- run instructioncontrasts with · A Dockerfile RUN instruction executes a command during container image construction, producing filesystem changes that become part of the resulting image.
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.

