ENTRYPOINT and CMD both define what runs when a container starts, but they serve different roles and interact in specific ways. Understanding the difference (and the two forms — exec vs shell) is important for writing Dockerfiles that behave correctly.
CMD — the default command (overridable)
CMD ["node", "server.js"]
# → the DEFAULT command when the container starts
# → but it's REPLACED if you pass a command at run time:
# docker run myapp echo hello → runs "echo hello" INSTEAD of node server.js
provides the , which is by any command given on .
