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

Unexpanded ARG variable causes incorrect warning about an invalid reference format #35

Closed
rcjsuen opened this issue Apr 15, 2018 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Apr 15, 2018

It is possible to use ARG variables in a FROM so they need to be expanded before we try to validate it.

ARG version=latest
FROM alpine:$version
$ docker build .
Sending build context to Docker daemon  1.695MB
Step 1/2 : ARG version=latest
Step 2/2 : FROM alpine:$version
latest: Pulling from library/alpine
ff3a5c916c92: Pull complete
Digest: sha256:7df6db5aa61ae9480f52f0b3a06a140ab98d427f86d8d5de0bedab9b8df6b1c0
Status: Downloaded newer image for alpine:latest
 ---> 3fd9065eaf02
Successfully built 3fd9065eaf02
$ dockerfile-utils lint Dockerfile.1
Line: 2
FROM alpine:$version
            ^^^^^^^^
Error: invalid reference format

Here are some other Dockerfiles that are also valid.

ARG version=atest
FROM alpine:l$version
ARG atest=atest
FROM alpine:l$atest
ARG DIGEST=sha256:7df6db5aa61ae9480f52f0b3a06a140ab98d427f86d8d5de0bedab9b8df6b1c0
FROM alpine@$DIGEST
@rcjsuen rcjsuen added the bug label Apr 15, 2018
@rcjsuen rcjsuen self-assigned this Apr 15, 2018
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