A container image build directive that specifies the default command or arguments for a container.
The CMD directive specifies the default command to run when Podman launches a container from an image. If omitted, the image inherits CMD from its parent image. section 2.3.1
Keep CMD distinct from related build and runtime directives:
RUN executes commands during image construction and commits their results; CMD runs only when a user launches the image without specifying another command. section 2.3.1
ENTRYPOINT configures the image as an executable and remains in place when arguments are passed to podman run. section 2.3.1
Default startup command
CMD /usr/bin/start.sh supplies the startup command when no command is provided at launch.
How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it
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 it assumes
Assumes familiarity with Containerfiles, parent images, image builds, and launching containers with Podman.
What you can do after
Apply CMD in a Containerfile to define an image's default Podman startup command.
How it connects
Connects CMD with Containerfile, Podman, ENTRYPOINT, RUN, and the OCI Runtime Specification.
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.
This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.