Read Dockerfile findings for exec arguments and build stages
Admin ·
Use the static checker to find a concrete instruction before you try to build. The worked example separates an exec argument problem from a stage reference problem.
Read the two sample findings
Select Load example and Check Dockerfile. Line 3 contains a number in the RUN exec array. Dockerfile exec-form arguments are strings, even when the command expects to interpret a number.
Line 5 asks for COPY --from=3. The two stages are numbered 0 and 1, so index 3 has no corresponding stage within this file.
| Line | Problem | One correction |
|---|---|---|
| 3 | Nonstring JSON argument | Write "7" as a string |
| 5 | Numeric stage index exceeds the stage list | Use --from=build |
Dockerfile referenceDockerfile shell and exec formsDocker multi-stage builds
Open the report after making the two edits
Quote the 7, replace --from=3 with --from=build and select Check Dockerfile. The output reports that the structure passed for two stages.
Download dockerfile-report.json. The findings array should be empty. Named source images or supplied named contexts may also be valid COPY sources, so check their availability separately.
Read the boundary of the supplied text
The checker follows early parser directives, logical continuation lines and supported literal heredoc boundaries. It does not interpret the commands in a RUN line.
A successful structure report covers the listed syntax checks. Actual copying and building depend on the context files, frontend, platform, images and command behavior.
Common questions
Why can a shell-form RUN line start with a bracket?
A shell command can begin with the test operator [. A JSON exec array is a separate instruction form. The checker looks for clear JSON array syntax or intent.
What if a heredoc has no closing line?
The checker reports the opening instruction. Add the matching delimiter on a line by itself. With <<-, leading tabs on the closing line are allowed.