moby / moby/buildkit

combination of warnings, errors and hints can get confusing

Open
#5,263 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ux kind/enhancement
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

Related to https://github.com/moby/buildkit/issues/5240, where I made a mistake in my HEREDOC syntax. Just jotting it down here; not sure what the best output would look like, but I think the combination of errors, warnings, hints being intertwined can be confusing.

Looking back at that ticket, I also realize now that the expanded ("per line") output is not related to the linting, but to the error. I recall I initially used the wrong delimited (used EOF for both the Dockerfile and the RUN heredoc); the combination of a warning and error quickly gets confusing as they're all interleaved;

In this case

  • error (RUN failed)
  • X warnings found
  • summary of warning(s)
  • details about error
  • error (again)
  • hint (view build details)
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN -<<'EOF'
env foo=bar
EOF
EOF

# .....
#9 [2/2] RUN -<<'EOF'
#9 0.116 /bin/sh: illegal option -<
#9 ERROR: process "/bin/sh -c -<<'EOF'" did not complete successfully: exit code: 2
------
 > [2/2] RUN -<<'EOF':
0.116 /bin/sh: illegal option -<
------

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)
Dockerfile:4
--------------------
   2 |
   3 |     FROM alpine
   4 | >>> RUN -<<'EOF'
   5 |     env foo=bar
   6 |
--------------------
ERROR: failed to solve: process "/bin/sh -c -<<'EOF'" did not complete successfully: exit code: 2

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/aiqna4u2fi004x8x3qriz463i
bash: EOF: command not found

After "fixing" the EOF -> EOT mistake;

  • warnings found
  • summary of warnings
  • error-details
  • error
  • hint
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN -<<'EOT'
env foo=bar
EOT
EOF

# .....
#3 CACHED

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)
Dockerfile:6
--------------------
   4 |     RUN -<<'EOT'
   5 |     env foo=bar
   6 | >>> EOT
   7 |
--------------------
ERROR: failed to solve: dockerfile parse error on line 6: unknown instruction: EOT (did you mean ENV?)

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/lcjyf5gzycy3bedca61xnnysz

Without heredoc (on Docker Desktop with scout plugin installed);

  • hint
  • warnings found
  • summary of warnings
  • scout hint
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN echo foo
env foo=bar
EOF

#8 DONE 0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/pdudz3dywoxrroyc77rekkztx

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is named in the report. Start by reproducing the three Docker build examples with --progress=plain and compare the warning, error, and hint ordering; completion would require an agreed output order and regression coverage for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.