Skip to main content

What is the difference between CMD and ENTRYPOINT?

Entry Docker
Quick Answer CMD sets the default command run at container startup รขโ‚ฌโ€ fully replaceable when you pass a command to docker run. ENTRYPOINT sets a fixed entry command that always runs รขโ‚ฌโ€ additional arguments from CMD or docker run are appended to it. ENTRYPOINT is for defining what the container IS; CMD is for its default behavior.

Answer

ENTRYPOINT defines the primary executable, while CMD provides default arguments. If both exist, CMD arguments are passed to ENTRYPOINT.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice