Dockerfile instructions

Dockerfile CMD

Defines replaceable runtime defaults. Without an entrypoint the command can be replaced by arguments after the image name; with an exec-form entrypoint CMD may supply its default arguments. Last CMD wins. Runtime replacement semantics depend on whether an entrypoint is configured.

Formal Syntax & Structure

docker syntaxdocker
CMD ["executable", "arg", ...] | CMD ["arg", ...] | CMD <command>

Parameters & Attributes

NameTypeDescription
executablestringProgram name when CMD supplies the command.
argstringDefault argument.

Working Example

Example Snippetdocker
FROM busybox:1.37CMD ["echo", "hello from image"]
Docker Reference