Open lxylxy123456 opened 4 years ago
Note that the container pushed to Docker Hub is not deterministic. Sometimes it is missing other files. For example, during another run I get this container (this time a
and b -> a
are missing)
root@2c3f4ff954c6:/# ls jkl
c e
root@2c3f4ff954c6:/# ls jkl -l
total 0
lrwxrwxrwx. 1 root root 1 Aug 25 01:41 c -> d
lrwxrwxrwx. 1 root root 1 Aug 25 01:41 e -> e
root@2c3f4ff954c6:/# exit
Might be related #1406
Maybe we have had the same problem here:
Our problem & solution was: We run the kaniko executor binary in an different image than the google default docker image. Our image is based on SLES. The Image we wanted to build with kaniko was based on RHEL. Since we changed the RHEL based Dockerimage also to SLES, the full filesystem snapshot is running successful.
We are using: kaniko 1.0.0 tekton 0.14.2 sles 15sp1:1.20.37 rhel Red Hat Enterprise Linux Server release 7.7 (Maipo)
Not only circular links, but also (some?) broken links cause this behaviour.
If there's a symlink /a -> /b/c/d
and the directory /b/c
doesn't exist, an error is printed couldn't eval /a with link /a
and not only the symlink gets left out, but also random other files get left out of the container.
I think latest kaniko doesn't have this problem?
I think latest kaniko doesn't have this problem?
I tested with 1.9.1 and this issue still exists.
Reproduced with gcr.io/kaniko-project/executor:v1.9.2-debug
An updated reproduction with https://github.com/GoogleContainerTools/kaniko/releases/tag/v1.16.0:
$ cat Dockerfile
FROM alpine
RUN mkdir /jkl; cd /jkl; echo 1 > a ; ln -s a b; ln -s d c; ln -s e e; ls -l
$ docker rmi -f rep
(...)
$ docker run \
-v `pwd`:/workspace \
gcr.io/kaniko-project/executor:v1.16.0 \
--dockerfile /workspace/Dockerfile \
--destination rep \
--no-push --tarPath /workspace/rep.tar
(...)
INFO[0002] RUN mkdir /jkl; cd /jkl; echo 1 > a ; ln -s a b; ln -s d c; ln -s e e; ls -l
INFO[0002] Initializing snapshotter ...
INFO[0002] Taking snapshot of full filesystem...
INFO[0002] Cmd: /bin/sh
INFO[0002] Args: [-c mkdir /jkl; cd /jkl; echo 1 > a ; ln -s a b; ln -s d c; ln -s e e; ls -l]
INFO[0002] Running: [/bin/sh -c mkdir /jkl; cd /jkl; echo 1 > a ; ln -s a b; ln -s d c; ln -s e e; ls -l]
total 4
-rw-r--r-- 1 root root 2 Sep 27 13:24 a
lrwxrwxrwx 1 root root 1 Sep 27 13:24 b -> a
lrwxrwxrwx 1 root root 1 Sep 27 13:24 c -> d
lrwxrwxrwx 1 root root 1 Sep 27 13:24 e -> e
INFO[0002] Taking snapshot of full filesystem...
ERRO[0002] Couldn't eval /jkl/e with link /jkl/e
INFO[0003] Skipping push to container registry due to --no-push flag
(...)
$ docker image load -i rep.tar
(...)
$ rm -rf rep.tar
$ docker run --rm --name rep rep ls -l jkl
total 4
-rw-r--r-- 1 root root 2 Sep 27 13:24 a
lrwxrwxrwx 1 root root 1 Sep 27 13:24 b -> a
lrwxrwxrwx 1 root root 1 Sep 27 13:24 e -> e
while with Docker:
$ docker rmi -f rep
(...)
$ docker build -t rep .
(...)
Step 2/2 : RUN mkdir /jkl; cd /jkl; echo 1 > a ; ln -s a b; ln -s d c; ln -s e e; ls -l
---> Running in 637034289a83
total 4
-rw-r--r-- 1 root root 2 Sep 27 13:30 a
lrwxrwxrwx 1 root root 1 Sep 27 13:30 b -> a
lrwxrwxrwx 1 root root 1 Sep 27 13:30 c -> d
lrwxrwxrwx 1 root root 1 Sep 27 13:30 e -> e
(...)
$ docker run --rm --name rep rep ls -l jkl
total 4
-rw-r--r-- 1 root root 2 Sep 27 13:30 a
lrwxrwxrwx 1 root root 1 Sep 27 13:30 b -> a
lrwxrwxrwx 1 root root 1 Sep 27 13:30 c -> d
lrwxrwxrwx 1 root root 1 Sep 27 13:30 e -> e
any update on this?
any update on this?
thisοΌ
Actual behavior When the docker image contains a symbolic to itself (e.g.
ln -s e e
, wheree
is the file name located in/jkl/
), kaniko fails by printing error message "ERRO[0012] couldn't eval /jkl/e with link /jkl/e", and the image pushed to the registry is incomplete.Expected behavior This error should not happen, and all files should be there.
To Reproduce Steps to reproduce the behavior:
kubectl logs kaniko
shows (note the last line is an error):c -> d
is gone):Expected (this is the result of building the image with docker)
Additional Information
Kaniko Image (fully qualified with digest)
Triage Notes for the Maintainers
--cache
flag