1) ENTRYPOINT and CMD are executed in the order in which they are displayed in the Docker file, regardless of whether the volumes are mounted
2) if you have an ENTRYPOINT starting verb, you can pass a parameter
3) yes to start docker, but some examples can clarify this, and docker exec will just take you to the container
4) CMD is executed when the container starts
5) you can use several CMDs in the Docker file, but only the latter will be used, docker is designed to start a single process,
if you want to run several, you will need tools like the supervisor http://docs.docker.com/articles/using_supervisord or runit or s6 or daemontools see http://docs.docker.com/faq
Since CMD is easily reevaluated rather than ENTRYPOINT (unless you are docker run --entrypoint ), you usually use ENTRYPOINT as the last one line in your Dockerfile and CMD as the last line, being actually a parameter that can change
source share