Skip to main content

DL3025: Use arguments JSON notation for CMD and ENTRYPOINT

Warning Maintainability

Why This Matters

Shell form (CMD command args) wraps your command in /bin/sh -c, which means the process runs as a child of the shell. This prevents proper signal propagation because SIGTERM sent by Docker to stop a container reaches the shell, not your application, causing ungraceful shutdowns. JSON form (CMD ["command", "args"]) runs the process directly so it receives signals correctly.

How to Fix

Convert shell form to JSON array form

Before (incorrect)

CMD node server.js

After (correct)

CMD ["node", "server.js"]

Rule Details

Rule Code
DL3025
Severity
Warning
Category
Maintainability

Related Rules