-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Hardlinks are not (well) supported by image unpacker #282
Comments
Thanks for the detailed description @vito! We're thinking this one through to see if there's anything we can do here. |
Hmm, So I was able to easily repro this with your broken base. I then took your same initial Dockerfile (the one that installs/symlinks git) and pushed it to my registry: FROM alpine
RUN apk --no-cache add git
RUN rm /usr/bin/git && ln -s /usr/libexec/git-core/git /usr/bin/git
RUN git --version And then built the second image, referencing my registry: FROM $MYREGISTRY
RUN ls -al /usr/libexec/git-core/git /usr/bin/git
RUN git --version and couldn't repro this: lrwxrwxrwx 1 root root 25 Aug 10 15:27 /usr/bin/git -> /usr/libexec/git-core/git
lrwxrwxrwx 1 root root 25 Aug 10 15:27 /usr/libexec/git-core/git -> /usr/bin/git-receive-pack Any other info on how to got that broken image created in the first place? |
@dlorenc I think this might be subject to chance. When the layer It looks like, in your case, I'm not sure how the layer archives are created and whether it's using e.g. GNU |
Makes sense! Thanks for following up. |
Hi there! Very excited for Kaniko - I'm modeling Concourse's new Registry Image resource on Kaniko's image extraction process, and noticed one gotcha that affects Kaniko too.
The problem is rooted in the fact that Kaniko extracts image layers in reverse order.
Try having Kaniko fetch
vito/broken-base
and rungit
from the resulting rootfs.Here's a
Dockerfile
for that:And here's the
Dockerfile
forvito/broken-base
:I see this output:
So, it has
/usr/bin/git -> /usr/libexec/git-core/git
, but then it has/usr/libexec/git-core/git
pointing back to/usr/bin/git
. That's a circular symlink, with no actualgit
binary anymore.Running this same thing with Docker works fine:
Here's what's happening: the layer that installs
git
actually has/usr/bin/git
as a hardlink to/usr/libexec/git-core/git
. A later layer then replaces/usr/bin/git
with a symlink to that same target. But when the layers are processed in reverse, a symlink is first created at/usr/bin/git
, and then the hardlink entry in the prior layer ends up pointing/usr/libexec/git-core/git
back to the already-created symlink.This is "hardlink" entry is actually created as a symlink, as implemented in
fs_util.go
, which is also kinda weird but I don't think that's too important here.To be honest this feels like a pretty fundamental problem with the reverse order approach. :/ It's nice that it can do it all in one pass and that it doesn't need to write removed/changed files in earlier layers, but hardlinks kind of throw a wrench into things. I ended up just switching to chronological order in this commit: concourse/registry-image-resource@ecf520b
The text was updated successfully, but these errors were encountered: