Skip to main content

What is the difference between ENTRYPOINT exec form and shell form?

Junior Docker
Quick Answer Shell form (ENTRYPOINT cmd arg) runs through /bin/sh -c รขโ‚ฌโ€ the shell interprets it, so signal handling is poor (PID 1 is the shell, not your app). Exec form (ENTRYPOINT ["cmd", "arg"]) runs the process directly as PID 1 รขโ‚ฌโ€ receives signals correctly for graceful shutdown. Always use exec form in production.

Answer

Exec form uses no shell and passes signals properly. Shell form uses /bin/sh -c and makes signal forwarding harder.
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