kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Cached layer returns deleted file (symlink link)

Open aivarasko opened this issue 6 years ago • 2 comments

Actual behavior Building same image that contains file removal returns removed file when cache is used. On first build when no cache exists file is removed. On second build when cache hit used file exists but it should not.

Expected behavior Cached layer should not return removed file.

To Reproduce Steps to reproduce the behavior:

  1. Build image on Kubernetes with tag tag1 ... image: gcr.io/kaniko-project/executor:v0.14.0 args: ["--context=s3://.../context.tar.gz", "--destination=aws_ecr/image:tag1", "--cache"] ...

  2. Build image on Kubernetes with tag tag2 ... image: gcr.io/kaniko-project/executor:v0.14.0 args: ["--context=s3://.../context.tar.gz", "--destination=aws_ecr/image:tag2", "--cache"] ...

  3. docker run -it aws_ecr/image:tag1 ls /etc/apache2/sites-enabled/ no output as expected (tag1 was built because no cache existed)

  4. docker run -it aws_ecr/image:tag2 ls /etc/apache2/sites-enabled/ 000-default.conf there should be no files, because it was explicitly removed in Dockerfile. This time cache was used because same build context just different tag name.

Additional Information

  • Dockerfile FROM php:7.1-apache-stretch RUN rm /etc/apache2/sites-enabled/000-default.conf

  • Build Context Dockerfile

  • Kaniko Image (fully qualified with digest) v0.14.0 sha256:2743a0d24915c94026f962d5ed429b5305bc0a57f0f5d6a7fcf390a8a311c7f8

aivarasko avatar Dec 30 '19 13:12 aivarasko

this is most likely a duplicate of https://github.com/GoogleContainerTools/kaniko/issues/704

cvgw avatar Dec 30 '19 21:12 cvgw

Closing. Duplicate of #704

aivarasko avatar Dec 31 '19 05:12 aivarasko