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 command ignores folders with same name as grandparent directory #221

Closed
gnur opened this issue Jul 2, 2018 · 1 comment · Fixed by #231
Closed

COPY command ignores folders with same name as grandparent directory #221

gnur opened this issue Jul 2, 2018 · 1 comment · Fixed by #231
Assignees
Labels
kind/bug Something isn't working

Comments

@gnur
Copy link

gnur commented Jul 2, 2018

I was debugging a strange issue and fount out that folders are not copied in certain situations.

With the following file tree:

.
├── app
│   ├── alpha
│   │   ├── 1
│   │   ├── 2
│   │   └── 3
│   ├── beta
│   │   ├── 1
│   │   ├── 2
│   │   └── 3
│   └── src
│       ├── 1
│       ├── 2
│       └── 3

If this filetree is mounted in /src the directory app/src would not get copied with a COPY /src/app /dest.

Steps to reproduce:

#!/bin/bash
 
 for i in alpha beta src; do
     for j in 1 2 3; do
         mkdir -p app/$i
         touch app/$i/$j
     done
 done

cat <<EOT > Dockerfile
FROM busybox
WORKDIR /workspace
COPY app /workspace
RUN find /workspace
EOT 

 docker run \
     -v $(pwd):/src \
     gcr.io/kaniko-project/executor:latest \
 -f /src/Dockerfile -d test/test -c /src/

output:

shm /proc/bus /proc/fs /proc/irq /proc/sys /proc/sysrq-trigger /proc/kcore /proc/keys /proc/timer_list /proc/sched_debug /sys/firmware]"
time="2018-07-02T10:08:43Z" level=info msg="Unpacking layer: 0"
time="2018-07-02T10:08:44Z" level=info msg="Not adding /dev because it is whitelisted"
time="2018-07-02T10:08:44Z" level=info msg="Taking snapshot of full filesystem..."
time="2018-07-02T10:08:44Z" level=info msg="cmd: workdir"
time="2018-07-02T10:08:44Z" level=info msg="Changed working directory to /workspace"
time="2018-07-02T10:08:44Z" level=info msg="Taking snapshot of files [/workspace]..."
time="2018-07-02T10:08:44Z" level=info msg="cmd: copy [app]"
time="2018-07-02T10:08:44Z" level=info msg="dest: /workspace"
time="2018-07-02T10:08:44Z" level=info msg="Creating directory /workspace"
time="2018-07-02T10:08:44Z" level=info msg="Creating directory /workspace/alpha"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/alpha/1 to /workspace/alpha/1"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/alpha/2 to /workspace/alpha/2"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/alpha/3 to /workspace/alpha/3"
time="2018-07-02T10:08:44Z" level=info msg="Creating directory /workspace/beta"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/beta/1 to /workspace/beta/1"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/beta/2 to /workspace/beta/2"
time="2018-07-02T10:08:44Z" level=info msg="Copying file /src/app/beta/3 to /workspace/beta/3"
time="2018-07-02T10:08:44Z" level=info msg="Taking snapshot of files [/workspace /workspace/alpha /workspace/alpha/1 /workspace/alpha/2 /workspace/alpha/3 /workspace/beta /workspace/beta/1 /workspace/beta/2 /workspace/beta/3]..."
time="2018-07-02T10:08:44Z" level=info msg="cmd: /bin/sh"
time="2018-07-02T10:08:44Z" level=info msg="args: [-c find /workspace]"
time="2018-07-02T10:08:44Z" level=info msg="Taking snapshot of full filesystem..."
/workspace
/workspace/beta
/workspace/beta/3
/workspace/beta/2
/workspace/beta/1
/workspace/alpha
/workspace/alpha/3
/workspace/alpha/2
/workspace/alpha/1
2018/07/02 10:08:44 No matching credentials found for index.docker.io, falling back on anonymous
time="2018-07-02T10:08:45Z" level=error msg="UNAUTHORIZED: \"authentication required\""

If you change src to alpha in the mount commands the same happens, except app/src does get copied and app/alpha no longer gets copied.

@priyawadhwa
Copy link
Collaborator

Hey @gnur , I just merged #231 which should fix this bug. Thanks for opening the issue, please reopen if you continue to get this error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants