Shell form vs exec form: what is the practical difference?
AdvancedConceptDockerfile Instructions & Builds
Answer
Shell form (CMD node app.js) runs /bin/sh -c "node app.js": variable expansion works but sh is PID 1 and swallows signals. Exec form (CMD ["node","app.js"]) runs the binary directly as PID 1, receives SIGTERM, but has no shell features ($VAR, &&, pipes). If you need expansion, use ["sh","-c","exec node app.js"].