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

COPY does not handle empty arguments well #181

Closed
joepvd opened this issue Jan 28, 2021 · 3 comments · Fixed by #190
Closed

COPY does not handle empty arguments well #181

joepvd opened this issue Jan 28, 2021 · 3 comments · Fixed by #190
Assignees

Comments

@joepvd
Copy link

joepvd commented Jan 28, 2021

cat <<EOF >Dockerfile
FROM centos
COPY Dockerfile "" /tmp/
RUN ls /
RUN ls /tmp
EOF
imagebuilder .

This will create a file /tmpDockerfile. in / docker build ignores the empty string.

Use case: An empty ARG variable that could be used to copy extra files in.

@derekhiggins
Copy link

derekhiggins commented Jan 28, 2021

This will create a file /tmpDockerfile. in / docker build ignores the empty string.

Just to add to this, imagebuilder puts anything in the source directory on the host into / (not limited to Dockerfile)
docker/podman build does something similar, but instead puts all the files into /tmp

@nalind nalind self-assigned this Mar 24, 2021
@nalind
Copy link
Member

nalind commented Mar 31, 2021

@joepvd which version of docker build are you testing with? When I run your reproducer with a file other than Dockerfile in the build context directory with 19.03.12 (say, by running touch NOT-THIS-FILE first), docker build copies it to the destination directory, too, as if the empty quoted value was being treated as * rather than being ignored.

@nalind
Copy link
Member

nalind commented Apr 1, 2021

@derekhiggins Thanks for clearing things up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants