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

ADDing file to symlink directory destroys symlink #774

Closed
cpeel opened this issue Sep 16, 2019 · 0 comments · Fixed by #857
Closed

ADDing file to symlink directory destroys symlink #774

cpeel opened this issue Sep 16, 2019 · 0 comments · Fixed by #857
Assignees
Labels
area/file-extraction kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@cpeel
Copy link

cpeel commented Sep 16, 2019

Actual behavior
ADDing a file to a directory that is a symlink to another directory destroys the symlink and recreates it as a directory.

Expected behavior
The file is added to the symlink destination rather than destroying the symlink, like docker build does.

To Reproduce
Create a file in the cwd that will be used for the docker context:

touch file

Dockerfile:

FROM phusion/baseimage:0.11
ADD file /etc/service/file

Build:

docker run --rm -it -v $(pwd):/workspace gcr.io/kaniko-project/executor:v0.12.0 \
    /kaniko/executor \
    --context /workspace
    --dockerfile /workspace/Dockerfile \
    --destination $REGISTRY/kaniko-repro

See how in the base container /etc/service is a symlink to /etc/runit/runsvdir/default:

$ docker run --rm -it phusion/baseimage:0.11 ls -l /etc/service
lrwxrwxrwx 1 root root 22 Nov 16  2017 /etc/service -> runit/runsvdir/default

Whereas in the kaniko-built container it's now a directory:

$ docker run --rm -it $REGISTRY/kaniko-repro ls -l /etc | grep service
drwxr-xr-x 2 root root        4096 Sep 16 20:17 service
$ docker run --rm -it $REGISTRY/kaniko-repro ls -l /etc/service
total 0
-rw-r--r-- 1 1000 1000 0 Sep 16 20:17 file

Additional information
docker build does the expected thing of putting the file in the destination symlink.

$ docker build -f Dockerfile -t $REGISTRY/kaniko-repro .
Sending build context to Docker daemon   2.56kB
Step 1/2 : FROM phusion/baseimage:0.11
 ---> 14e6c478b00a
Step 2/2 : ADD file /etc/service/file
 ---> db470ec738eb
Successfully built db470ec738eb
Successfully tagged $REGISTRY/kaniko-repro
$ docker run --rm -it $REGISTRY/kaniko-repro ls -l /etc/service
lrwxrwxrwx 1 root root 22 Nov 16  2017 /etc/service -> runit/runsvdir/default
$ docker run --rm -it $REGISTRY/kaniko-repro ls -lL /etc/service
total 8
drwxr-xr-x 2 root root 4096 Aug 16  2018 cron
-rw-r--r-- 1 root root    0 Sep 16 19:44 file
drwxr-xr-x 2 root root 4096 Aug 16  2018 sshd

@tejal29 tejal29 added area/file-extraction kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next. labels Sep 20, 2019
@cvgw cvgw self-assigned this Nov 1, 2019
@cvgw cvgw closed this as completed in #857 Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/file-extraction kind/bug Something isn't working priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants