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

Validator does not count arguments correctly for ADD and COPY instructions written in JSON #34

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

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Apr 4, 2018

The following Dockerfile can be built just fine but the validator will create warnings because it thinks there is only one argument in the two instructions since there are no spaces in the JSON.

FROM alpine
ADD ["t1.txt","t2.txt"]
COPY ["t1.txt","t2.txt"]
$ dockerfile-utils lint Dockerfile
Line: 2
ADD ["t1.txt","t2.txt"]
    ^^^^^^^^^^^^^^^^^^^
Error: ADD requires at least two arguments

Line: 3
COPY ["t1.txt","t2.txt"]
     ^^^^^^^^^^^^^^^^^^^
Error: COPY requires at least two arguments
$ docker build .
Sending build context to Docker daemon  1.696MB
Step 1/3 : FROM alpine
 ---> 3fd9065eaf02
Step 2/3 : ADD ["t1.txt","t2.txt"]
 ---> 5b13022208ff
Step 3/3 : COPY ["t1.txt","t2.txt"]
 ---> 057ec728c238
Successfully built 057ec728c238
@rcjsuen rcjsuen added the bug label Apr 4, 2018
@rcjsuen rcjsuen self-assigned this Apr 4, 2018
@rcjsuen rcjsuen closed this as completed in 7486e54 Apr 4, 2018
rcjsuen added a commit that referenced this issue Apr 4, 2018
Cover all the cases that can occur if the JSON format is used but
there are only two actual arguments written for ADD and COPY
instructions.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
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