Problem encountered building an image where the hard link to a file is changed over dependent images i.e image im-c dependent on im-b dependent on im-a.
In the following test sequence the build of the final image (im-c) will fail with link #### file exists" error.
Dockerfile for im-a:1.0.0
FROM debian:latest
WORKDIR /
#
# create abc and hard link to the_link_file
#
RUN /bin/bash -ec "echo 'abc' > abc ; ln abc the_link_file"
check the link status by running docker run -it im-a:1.0.0 bash
cd /
ls -i abc
2163 abc
ls -i the_link_file
2163 the_link_file
Salient build log, built with verbosity = "debug" shows link and file add :-
…
122179: Adding /the_link_file to layer, because it was changed.
…
126801 : Adding /abc to layer, because it was changed.
…
126802: /abc inode exists in hardlinks map, linking to /the_link_file
Dockerfile for im-b:1.0.0
FROM im-a:1.0.0
WORKDIR /
#
# create def and link to the_link_file unlink abc in the process
#
RUN /bin/bash -ec "echo 'def' > def ; ln -f def the_link_file"
check the link status by running docker run -it im-b:1.0.0 bash
cd /
ls -i abc
2163 abc
ls -i def
2164 def
ls -i the_link_file
2164 the_link_file
Salient build log, built with verbosity = "debug"
…
7195 : creating file /the_link_file
7196 : link from /the_link_file to /abc
…
105482: Adding /def to layer, because it was changed.
…
105858 : Adding /the_link_file to layer, because it was changed.
105859 : /the_link_file inode exists in hardlinks map, linking to /def
Dockerfile for im-c:1.0.0
FROM im-b:1.0.0
WORKDIR /
RUN /bin/bash -ec "echo 'never gets here !'"
Build fails with :-
….
7193 : Extracting layer 1
7194 : creating file /the_link_file
7195 : link from /the_link_file to /abc
7196 : creating dir /
7197 : Extracting layer 2
7198 : creating file /def
7199 : link from /def to /the_link_file
7200 : Error: error building image: link /def /the_link_file: file exists
7201 : Usage:
7202 : executor [flags]
…
Thanks for the detailed report, @ibcodemonkey. I'm running into this issue too, and without a fix, I can't adopt kaniko.
This bug should be fixed by PR #360 .
@ibcodemonkey, could you see if you're still getting the same error with the latest version of the image? This may have been fixed by #360.
I am running into a similar issue with one of my builds. I'm trying to use a base image that is provided by JBoss and get this error during the download & extract before it reaches any of my instructions:
DEBU[0026] symlink from /deployments to /opt/eap/standalone/deployments
error building image: error building stage: error removing opt/eap/standalone/deployments to make way for new symlink: remove /opt/eap/standalone/deployments: directory not empty
I looked at the contents of /opt/eap/standalone/deployments and found a README.md file. Same command runs fine using Docker and appears to have moved the README to /deployments.
@devderek could you open up an issue for this bug, with the Dockerfile you're trying to build?
My Dockerfile pulls an image from a private repo so I'm not able to make it reproduceable here. I suspect the root causes are similar. I'll see if I can reproduce a similar scenario. If I can I will certainly post a new issue. Thanks!