Intermediate
Docker & Containers
Q55 / 100
What is the difference between "CMD [\"executable\", \"param\"]" (exec form) and "CMD executable param" (shell form) in a Dockerfile?
Correct! Well done.
Incorrect.
The correct answer is B) Exec form runs the command directly without a shell (so the process becomes PID 1 and properly receives signals like SIGTERM), while shell form wraps the command in "/bin/sh -c", which can interfere with signal handling
B
Correct Answer
Exec form runs the command directly without a shell (so the process becomes PID 1 and properly receives signals like SIGTERM), while shell form wraps the command in "/bin/sh -c", which can interfere with signal handling
Explanation
Exec form avoids an extra shell process, making the application PID 1 and able to receive signals (like SIGTERM from "docker stop") directly, while shell form runs the command through "/bin/sh -c", which may not forward signals properly.
Progress
55/100