You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When hadolint (2.12.1) parses a heredoc RUN or COPY command, it checks the character that follows the command (i.e., right after the second instance of the identifier/delimiter/keyword), unless it's at the end of the file. If that character is not whitespace, hadolint reports an error, um, erroneously.
Basically the same bug was reported last year but in the hadolint/hadolint repo. I'm fairly sure the bug stems from Language/Docker/Parser/Prelude.hs. It doesn't matter if the unrelated character is part of a comment or a command, but obviously it's unrelated.
Minimal example of failure:
FROM scratch
RUN <<EOR
echo "asdf"
EOR
#
dd:5:1 unexpected '#' expecting a new line followed by the next instruction
This works:
FROM scratch
RUN <<EOR
echo "asdf"
EOR
#
The same goes for heredoc COPY commands/instructions. This fails:
FROM nginx
COPY <<EOF /usr/share/nginx/html/index.html
(your index page goes here)
EOF
#
COPY <<EOF /usr/share/nginx/html/index.html
(your index page goes here)
EOF
copy.dockerfile:6:1 unexpected '#' expecting a new line followed by the next instruction
But this works:
FROM nginx
COPY <<EOF /usr/share/nginx/html/index.html
(your index page goes here)
EOF
#
COPY <<EOF /usr/share/nginx/html/index.html
(your index page goes here)
EOF
copy.dockerfile:1 DL3006 warning: Always tag the version of an image explicitly
Thanks.
The text was updated successfully, but these errors were encountered:
When hadolint (2.12.1) parses a heredoc RUN or COPY command, it checks the character that follows the command (i.e., right after the second instance of the identifier/delimiter/keyword), unless it's at the end of the file. If that character is not whitespace, hadolint reports an error, um, erroneously.
Basically the same bug was reported last year but in the hadolint/hadolint repo. I'm fairly sure the bug stems from Language/Docker/Parser/Prelude.hs. It doesn't matter if the unrelated character is part of a comment or a command, but obviously it's unrelated.
Minimal example of failure:
dd:5:1 unexpected '#' expecting a new line followed by the next instruction
This works:
The same goes for heredoc COPY commands/instructions. This fails:
But this works:
copy.dockerfile:1 DL3006 warning: Always tag the version of an image explicitly
Thanks.
The text was updated successfully, but these errors were encountered: