Created
July 24, 2018 07:11
-
-
Save AkihiroSuda/978c94bc2297867ba60d8cba5a893def to your computer and use it in GitHub Desktop.
Docker v18.06 `RUN --mount=type=cache` example (keep /var/cache/apt)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax = tonistiigi/dockerfile:runmount20180618 | |
# | |
# `RUN --mount` example. Requires Docker v18.06 with `DOCKER_BUILDKIT=1`. | |
# | |
# `RUN --mount=... apt install <PKGS>` should finish immediately even when some packages are added to <PKGS> or built with `docker build --no-cache`. | |
FROM ubuntu | |
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache | |
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked \ | |
apt update && apt install -y gcc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment