low · dockerfile/build-without-cache-mount

Build without BuildKit cache mount

Package installs and compiles are faster when BuildKit cache mounts are used.

Why it breaks the cache

Without cache mounts, package managers re-download artifacts more often than needed.

Bad Dockerfile

RUN npm ci

Good Dockerfile

RUN --mount=type=cache,target=/root/.npm npm ci

CLI

layerlint rules explain build-without-cache-mount

All docs · Download