News for hackers. Stuff that matters.
Re:Accelerating Docker Builds by Halving EC2 Boot Time by westurner on Saturday May 24, 2025 @03:28AM (#44079411)
RUN --mount=type=cache can also significantly reduce build times if there is inter-build locality; i.e. if container build jobs run on the same nodes so that cache mounts can be reused by subsequent build jobs.

Examples of docker image cache mounts:

  # yum + dnf
  RUN --mount=type=cache,id=yum-cache,target=/var/cache/yum,sharing=shared \
    --mount=type=cache,id=dnf-cache,target=/var/cache/dnf,sharing=shared \

  # apt
  RUN --mount=type=cache,id=aptcache,target=/var/cache/apt,sharing=shared
  
  # pip
  RUN --mount=type=cache,id=pip-cache,target=${apphome}/.cache/pip,sharing=shared \

  # cargo w/ uid=1000
  RUN --mount=type=cache,id=cargocache,target=${apphome}/.cargo/registry,uid=1000,sharing=shared \
"Optimize cache usage in builds" https://docs.docker.com/build/cache/optimize/

There are no comments on this comment yet.