Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Whitespace before the delimiter in the heredoc causes the content to be interpreted as Dockerfile instructions #130

@rcjsuen

Description

@rcjsuen
FROM alpine
RUN cat << 'EOF' > /root/.zshrc
setopt PROMPT_SUBST
autoload -U colors && colors
PS1='%n@%m %~ $ '
EOF
$ dockerfile-utils lint
Line: 3
setopt PROMPT_SUBST
^^^^^^
Error: Unknown instruction: SETOPT

Line: 4
autoload -U colors && colors
^^^^^^^^
Error: Unknown instruction: AUTOLOAD

Line: 5
PS1='%n@%m %~ $ '
^^^^^^^^^^
Error: Unknown instruction: PS1='%N@%M

Line: 6
EOF
^^^
Error: Unknown instruction: EOF
docker build --no-cache -t rcjsuen:latest -f Dockerfile .
[+] Building 0.2s (6/6) FINISHED                                                              docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                          0.0s
 => => transferring dockerfile: 156B                                                                          0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                              0.0s
 => [internal] load .dockerignore                                                                             0.0s
 => => transferring context: 2B                                                                               0.0s
 => CACHED [1/2] FROM docker.io/library/alpine:latest@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc  0.0s
 => => resolve docker.io/library/alpine:latest@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990  0.0s
 => [2/2] RUN cat << 'EOF' > /root/.zshrc                                                                     0.1s
 => exporting to image                                                                                        0.1s
 => => exporting layers                                                                                       0.0s
 => => exporting manifest sha256:def637f63177b0fb4c9411da03d9499e58f297209317ad732c7c1695df85bc41             0.0s
 => => exporting config sha256:d8849b5a5847ffe80dc2cf85e29c1e4e67a43389917db05764c4043e73a0a2ae               0.0s
 => => exporting attestation manifest sha256:9a1649cd7dba418a055619d2fee7dec7a004a0c0d49d84fbbd5804e6176209a  0.0s
 => => exporting manifest list sha256:bb42cf0e01335d8dd6c8b621fc13a9afa511e7a0150c1c4a8f93502b2fac2fe8        0.0s
 => => naming to docker.io/library/rcjsuen:latest                                                             0.0s
 => => unpacking to docker.io/library/rcjsuen:latest                                                          0.0s

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions