Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable default value should be considered instead of flagging it as an error #126

Closed
rcjsuen opened this issue Jun 18, 2024 · 0 comments
Closed
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Jun 18, 2024

FROM ${VAR:-alpine}

We should not be flagging the variable as an error as -alpine means that alpine should be swapped in if the variable is not set.

$ dockerfile-utils lint Dockerfile.2
Line: 1
FROM ${VAR:-alpine}
     ^^^^^^^^^^^^^^
Error: base name (${VAR:-alpine}) should not be blank
$ docker build -f Dockerfile.2 .
[+] Building 2.1s (6/6) FINISHED                                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile.2                                                                              0.0s
 => => transferring dockerfile: 59B                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                    1.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                       0.0s
 => [internal] load .dockerignore                                                                                                   0.0s
 => => transferring context: 2B                                                                                                     0.0s
 => [1/1] FROM docker.io/library/alpine:latest@sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd              1.0s
 => => resolve docker.io/library/alpine:latest@sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd              0.0s
 => => sha256:77726ef6b57ddf65bb551896826ec38bc3e53f75cdde31354fbffb4f25238ebd 1.85kB / 1.85kB                                      0.0s
 => => sha256:216266c86fc4dcef5619930bd394245824c2af52fd21ba7c6fa0e618657d4c3b 528B / 528B                                          0.0s
 => => sha256:1d34ffeaf190be23d3de5a8de0a436676b758f48f835c3a2d4768b798c15a7f1 1.47kB / 1.47kB                                      0.0s
 => => sha256:d25f557d7f31bf7acfac935859b5153da41d13c41f2b468d16f729a5b883634f 3.62MB / 3.62MB                                      0.4s
 => => extracting sha256:d25f557d7f31bf7acfac935859b5153da41d13c41f2b468d16f729a5b883634f                                           0.3s
 => exporting to image                                                                                                              0.0s
 => => exporting layers                                                                                                             0.0s
 => => writing image sha256:b4627cf16b569c0672269d26e194453a38cc283185da70f6214f6f23bfc607e4                                        0.0s

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant