Skip to content

Container Cache

Prayag edited this page Jan 6, 2023 · 6 revisions

If you’re sick of re-downloading all external dependencies every time there’s a change to one of them, the cache mount can help you save time in the future.

Inside of your Dockerfile, add a mount flag, specifying which directories should be cached during the step.

https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#mount-types

Example:

FROM gradle:7.3-jdk11 as builder

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/cache/apt 
Clone this wiki locally