Differences between CMD and ENTRYPOINT with example.
CMD | ENTRYPOINT |
Can be overridden | Cannot be overridden |
Cannot append additional params | Can be appended |
Command to run when container starts or arg to ENTRYPOINT if specified | Always first command to run when container starts |
Multiple times can be added in the dockerfile but the last line will override the previous | Same behavior as CMD |
Treated as additional param when it is used along with ENTRYPOINT | Always the main command |