The COMMAND parameter is not mandatory, the author of the image may have already provided a default COMMAND using the CMD instruction in the Dockerfile. The CMD occurs only once in a Dockerfile and it's usually the last instruction. When starting the container from an image, we can override the CMD instruction, simply by providing our own command or parameters as the COMMAND parameter for the docker run. Anything that appears after the image name in the docker run command will be passed to the container and treated as CMD arguments. If the image also specifies an ENTRYPOINT then the CMD or ...
It is confusing that both CMD and ENTRYPOINT come in different forms (exec forms vs shell forms etc)
My take on this is: stick to the recommanded forms (exec forms) and start from there.
When both CMD and ENTRYPOINT are in exec forms, they are excuted as "ENTRYPOINT CMD", CMD being replaced at runtime if user speficies new "command".
It is also worth noticing is when ENTRYPOINT is in default, it's actually "/bin/sh -c" so anything you specify in CMD will be excuted.
This note will be revisited.
Share this highlighthttp://www.safaribooksonline.com/a/docker-and-kubernetes/10815886/