Knowledge Base
Search
New article
Authentication is disabled (development mode).
Edit article
Title
Tags
Content
<p>The CMD instruction sets the command to be executed when running a container from an image.</p><ul><li> CMD command param1 param2</li><li> CMD ["executable", "param1", "param2"]</li><li> CMD ["param1", "param2"] # -> ENTRYPOINT</li></ul><p>There can only be one CMD instruction in a Dockerfile. If you list more than one CMD, only the last one takes effect.</p><p>The purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well.</p><p>If the user specifies arguments to docker run then they will override the default specified in CMD, but still use the default ENTRYPOINT.</p><p>Command line arguments to docker run <image> will be appended after all elements in an exec form ENTRYPOINT, and will override all elements specified using CMD.</p>
Save
Cancel