advancedTop 100 Interview Questions

Why is exec form preferred over shell form for CMD/ENTRYPOINT?

Exec form (`["java","-jar","app.jar"]`) runs the process directly as PID 1, so it receives signals like SIGTERM correctly for graceful shutdown. Shell form (`java -jar app.jar`) wraps the command in `/bin/sh -c`, making the shell PID 1 and the actual process a child that may not receive signals properly, breaking graceful shutdown.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

Why is exec form preferred over shell form for CMD/ENTRYPOINT?

Next Step

Continue to What is the difference between ARG and ENV?← Back to all Docker questions