Skip to content

CMD vs ENTRYPOINT

Select an icon to see what it is.

Step 1 of 6

CMD is the default command

CMD sets the command a container runs when you give none. It is stored in the image config as Cmd. Anything you put after the image name in docker run replaces it completely.

$ docker run --rm alpine echo hi
PrevNext

alpine's own config and your override

image config: Cmd ["/bin/sh"]
docker run alpine echo hi -> Cmd ["echo","hi"]
the container runs: echo hi