advancedTop 100 Interview Questions

What's the practical difference between CMD and ENTRYPOINT?

CMD provides a default command (and/or default arguments) that is entirely overridden if the user supplies a command at `docker run`. ENTRYPOINT defines the fixed executable that always runs; when both are present, CMD's value becomes ENTRYPOINT's default arguments rather than being replaced outright.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why is exec form preferred over shell form for CMD/ENTRYPOINT?← Back to all Docker questions