ENTRYPOINT e CMD definiscono entrambi cosa viene eseguito all'avvio di un container, ma svolgono ruoli diversi e interagiscono in modo specifico. Comprendere la differenza (e le due forme — exec vs shell) è importante per scrivere Dockerfile che si comportano correttamente.
CMD — il comando predefinito (sovrescrivibile)
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
fornisce il , che è da qualsiasi comando fornito in .
