kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Feature request: Cache base image in repository

Open dbadura opened this issue 3 years ago • 0 comments

Actual behavior Currently Kaniko fetch base image every time I build, even I have repository cache turn on. This behavior heavily depends on internet speed, which can be pretty slow (e.g.: mobile internet).

There is a solution with warmer, but in our case add additional overhead which we want to bypass. Especially that repository is used as cache.

Expected behavior I would like to add some flag like: --cache-base-image to prevent kaniko from fetching base image every time I am building something and make kaniko to use cache from repository.

To Reproduce Steps to reproduce the behavior:

  1. Run this script:
docker run  --publish 5000:500 --network host --rm --name registry --detach \
  registry:2 /etc/docker/registry/config.yml

PWD=$(pwd)
IP="${IP:-127.0.0.1}"
docker run -v "${PWD}":/workspace \
  --network host \
  --rm \
  eu.gcr.io/kyma-project/tpi/kaniko-executor:1.9.0-a550386f \
  --insecure \
  --skip-tls-verify \
  --verbosity debug \
  --skip-unused-stages \
  --log-format=text \
  --cache=true \
  --force \
  --destination="${IP}":5000/default-function-001-v2:5b759bc8169808cba87125ac0eceef83705f0a985f04a5f9ce4c051158d5c2c4 \
  --context=dir:///workspace

Additional Information

  • Dockerfile, can be any
ARG base_image=eu.gcr.io/kyma-project/function-runtime-python39:f94d14f3
FROM ${base_image}
USER root
ENV KUBELESS_INSTALL_VOLUME=/kubeless

COPY /src/requirements.txt $KUBELESS_INSTALL_VOLUME/requirements.txt
RUN pip install -r $KUBELESS_INSTALL_VOLUME/requirements.txt
COPY /src $KUBELESS_INSTALL_VOLUME

RUN rm -rf /etc/pip.conf

USER 1000
  • Build Context Please provide or clearly describe any files needed to build the Dockerfile (ADD/COPY commands) empty requirements.txt and handler.py with:
def main(event, context):
    return "hello world"

in src dir

  • Kaniko Image (fully qualified with digest): 1.9.0-a550386f

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [ ]
Please check if this error is seen when you use --cache flag
  • - [ ]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]

dbadura avatar Sep 20 '22 07:09 dbadura