1

I have a Dockerfile and I'm building container image on Google Cloud Build (GCP) using Kaniko.

About my Dockerfile

The Dockerfile has 4 stages (Multi-Stage Build). And there are 13 RUN or COPY steps in the Dockerfile.

Current build speed.

Kaniko on GCP

  • Full build on Kaniko: about 10minutes.
  • Rebuild without code change: about 3~4 minutes

docker build on my local Mac

  • Full build: About 6 min 58 sec.
  • Rebuild without code change: 3.48 sec.

Question

I'd like to try to decrease the count of cache pulling and cache saving if Kaneko can do it.

Kaniko looks don't have an option to take snapshots by each docker build stage. (not each step) https://github.com/GoogleContainerTools/kaniko/blob/master/README.md

Does anyone know a solution?

Otherwise, Do you have an idea about suppress cache pulling/cache saving overhead?

tomlla
  • 519
  • 1
  • 6
  • 15
  • I see that kaniko (1.6.0) provides the option `--single-snapshot` (takes a single snapshot of the filesystem at the end of the build, so only one layer will be appended to the base image) but I've never tried it. – Davide Madrisan Aug 19 '21 at 16:36

1 Answers1

0

similar issue where kaniko was taking a current image of filesystem after every docker command and some taking upwards of ~5 mins each which was too long,

2022-11-04T09:09:38+13:00 INFO[0170] Taking snapshot of full filesystem...        
2022-11-04T09:09:38+13:00 DEBU[0170] Current image filesystem: map[ ***REMOVED LARGE LOGS****  ]
***~5mins***
2022-11-04T09:14:43+13:00 DEBU[0000] Getting source context from dir:// 

tried the parameter mentioned,

--single-snapshot

which did skip the intermediate snapshots saving tons of time,

DEBU[0169] Build: skipping snapshot for [RUN ls -la /workspace/appHelloWorld]