| Property | Value |
|---|---|
| Severity | Error |
| Category | Correctness |
| Default | Enabled |
| Auto-fix | Yes (suggestion, requires --fix-unsafe) |
Description
Several Dockerfile instructions (CMD, ENTRYPOINT, RUN, SHELL, COPY, ADD,
VOLUME, HEALTHCHECK CMD, ONBUILD <instruction>) accept JSON exec-form syntax:
[ but contain invalid JSON (unquoted strings, single
quotes, trailing commas), BuildKit’s parser silently treats them as shell form. This
produces unexpected behavior:
CMD [bash, -lc, "echo hi"]is treated as the shell command[bash, -lc, "echo hi"]rather than exec-form["bash", "-lc", "echo hi"].SHELL [/bin/bash, -c]causes a build error becauseSHELLrequires valid JSON.
suggestion
because intent cannot be guaranteed — review it before applying.
Related Rules
buildkit/JSONArgsRecommended— recommends JSON exec-form forCMDandENTRYPOINT. Because BuildKit falls back to shell-form when JSON is invalid,JSONArgsRecommended(info severity) also fires on the same instruction. tally’s supersession processor automatically suppresses the lower-severityJSONArgsRecommendedviolation when this rule (error severity) is present at the same line — so users see only the more actionableinvalid-json-formerror.