Docker Concepts
Dockerfile shell and exec forms
Shell form invokes the configured shell; exec form passes an argument vector and does not implicitly perform shell expansions. Similar distinctions apply to RUN and ENTRYPOINT. Explicit shell invocation is possible. Check the effective shell configuration; explicit sh -c can expand variables even in exec form.
Formal Syntax & Structure
docker syntaxdocker
CMD <shell command> | CMD ["executable", "arg", ...]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| command | string | Shell expression or executable argument array. |
Working Example
Example Snippetdocker
FROM busybox:1.37ENV GREETING=helloCMD ["echo", "$GREETING"]