kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Bug (Misbehaviour): Kaniko doesn't make an error when file is in .dockerignore

Open helltraitor opened this issue 10 months ago • 0 comments

Actual behavior When some path in .dockerignore, kaniko unable to copy file and make warning

Expected behavior Kaniko must make an error when this occurs (same as docker build do)

To Reproduce Steps to reproduce the behavior:

  1. Create any file with any content
  2. Add this file to .dockerignore

Additional Information

  • Dockerfile (nginx for php-fpm, no static files)
    FROM nginx:1.27.4-alpine3.21
    
    WORKDIR /var/www
    
    COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
    
    # In case of problems, comment this line or try fix: https://github.com/GoogleContainerTools/kaniko/issues/1278
    RUN nginx -t
    
  • Build Context: repository root $CI_PROJECT_DIR (gitlab)
  • Kaniko Image: gcr.io/kaniko-project/executor:debug (perhaps the latest), from logs:
    Using docker image sha256:16b383e1c3b259d59f75a2720a45ccf15b3a716cef44c6a5c521ceb471117168 for gcr.io/kaniko-project/executor:debug with digest gcr.io/kaniko-project/executor@sha256:c3109d5926a997b100c4343944e06c6b30a6804b2f9abe0994d3de6ef92b028e
    
Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
(Yes)
Please check if the build works in docker but not in kaniko
  • - [ ]
(Yes)
Please check if this error is seen when you use --cache flag
  • - [ ]
(Unknown)
Please check if your dockerfile is a multistage dockerfile
  • - [ ]
(Yes)

Since latest bugs in kaniko, we don't use cache, I think this is not related

Additional (kaniko)

WARN[0001] No files to copy                             
INFO[0001] COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf 
WARN[0001] No files to copy   

Additonal (docker build)

=> ERROR [nginx 3/4] COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf                                                                                                                                                                                     0.0s
------
 > [nginx 3/4] COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf:
------
Dockerfile:64
--------------------
  62 |     WORKDIR /var/www
  63 |
  64 | >>> COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
  65 |
  66 |     # In case of problems, comment this line or try fix: https://github.com/GoogleContainerTools/kaniko/issues/1278
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 30d37959-a4ef-4605-bab9-743e416d95fa::evv3njrzmhfpj09ivpftlfgi7: "/docker/etc/nginx/conf.d/default.conf": not found

helltraitor avatar Feb 19 '25 14:02 helltraitor