From 239d1ef301eb8d9b2b1e8469489b25ff3708f47f Mon Sep 17 00:00:00 2001 From: unclejack Date: Thu, 15 May 2014 11:56:23 +0300 Subject: [PATCH] docs: explain when RUN cache gets invalidated This adds a few lines to the RUN Dockerfile docs to explain how to bypass the RUN caching and how ADD can also invalidate the cache for these instructions. Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) --- docs/sources/reference/builder.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md index 4c726aafa2..c3ba939550 100644 --- a/docs/sources/reference/builder.md +++ b/docs/sources/reference/builder.md @@ -131,6 +131,16 @@ any point in an image's history, much like source control. The *exec* form makes it possible to avoid shell string munging, and to `RUN` commands using a base image that does not contain `/bin/sh`. +The cache for `RUN` instructions isn't invalidated automatically during the +next build. The cache for an instruction like `RUN apt-get dist-upgrade -y` +will be reused during the next build. +The cache for `RUN` instructions can be invalidated by using the `--no-cache` +flag, for example `docker build --no-cache`. + +The first encountered `ADD` instruction will invalidate the cache for all +following instructions from the 'Dockerfile' if the contents of the context +have changed. This will also invalidate the cache for `RUN` instructions. + ### Known Issues (RUN) - [Issue 783](https://github.com/dotcloud/docker/issues/783) is about file