Well, most of the folks are really confused about the difference between ENTRYPOINT and CMD, so you.
Its simple. Whatever you fill in CMD will be given to the ENTRYPOINT as an argument.
For ex: If you have a dockerfile like this.
and when you run the container without any other command ( For ex:#docker run …..
The above instruction basically make it something like “netstat -tulpn” for the container to execute.
Also there is a default entrypoint for each container which is nothing but “/bin/sh -c”
. However note that, the CMD used at end of the ” #docker run …
You also need to pay some attention on the syntax you use for CMD or ENTRYPOINT. The difference when you use array syntax ( CMD [” “] or shell syntax ( CMD ls -l) is nothing but, if you are not using the array syntax the arguments are prepended with the default entry point which is nothing but “/bin/sh -c”. It may generate unexpected result. So, its always adviceable to use array syntax when using CMD or ENTRYPOINT.