ENTRYPOINT defines the main executable that Docker will use. If entrypoint is not given, then CMD
will be used as a command that is executed.
CMD defines the default arguments for the ENTRYPOINT
. Note that CMD
argument can be overridden when running the container with alternative arguments.
We can think them as pair that are concatenated ENTRYPOINT + CMD
.
For example, let's build container that pings three times a given network host. If no host is given, then it should ping localhost as a default.