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

Create diagnostic for warning about unknown flags #75

Closed
rcjsuen opened this issue Jul 16, 2017 · 2 comments
Closed

Create diagnostic for warning about unknown flags #75

rcjsuen opened this issue Jul 16, 2017 · 2 comments
Assignees

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Jul 16, 2017

FROM alpine AS x
FROM alpine as y
COPY --FROM=x . .

Trying to build the above Dockerfile will generate the following error. We should create a diagnostic to recognize this error.

$ docker build .
Sending build context to Docker daemon  86.15MB
Step 1/3 : FROM alpine AS x
latest: Pulling from library/alpine
88286f41530e: Pull complete
Digest: sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe
Status: Downloaded newer image for alpine:latest
 ---> 7328f6f8b418
Step 2/3 : FROM alpine AS y
 ---> 7328f6f8b418
Step 3/3 : COPY --FROM=x . .
Unknown flag: FROM
@rcjsuen
Copy link
Owner Author

rcjsuen commented Jul 18, 2017

The other instruction that supports flags is HEALTHCHECK with a CMD We should also validate these flags.

  1. --interval=30s
  2. --timeout=30s
  3. --start-period=0s
  4. --retries=3

@rcjsuen
Copy link
Owner Author

rcjsuen commented Jul 18, 2017

Docker doesn't seem to validate the misnamed flags if a NONE is found for a HEALTHCHECK.

$ cat Dockerfile
FROM alpine
HEALTHCHECK --timeo=1s --retrie=5 NONE
$ docker build .
Sending build context to Docker daemon  86.15MB
Step 1/2 : FROM alpine
 ---> 7328f6f8b418
Step 2/2 : HEALTHCHECK --timeo=1s --retrie=5 NONE
 ---> Running in 24d5ba296300
 ---> 899ec05d3623
Removing intermediate container 24d5ba296300
Successfully built 899ec05d3623

rcjsuen added a commit that referenced this issue Jul 18, 2017
COPY supports a --from=stage flag for specifying the build stage to
copy content from. If the flag is incorrectly named, we should warn
the user of this fact. If the flag is not written all in lowercase,
an error will be generated as flags are case-sensitive in
Dockerfiles.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
@rcjsuen rcjsuen self-assigned this Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant