From f30ca8935d128bbd060a04b47cec2f26d682797b Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Fri, 10 Jan 2014 15:33:19 +1000 Subject: [PATCH] add info and example of image cache in use when building Docker-DCO-1.1-Signed-off-by: Sven Dowideit (github: SvenDowideit) Docker-DCO-1.0-Signed-off-by: Sven Dowideit (github: SvenDowideit) --- docs/sources/use/builder.rst | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/sources/use/builder.rst b/docs/sources/use/builder.rst index 81145a6ee8..e61db62689 100644 --- a/docs/sources/use/builder.rst +++ b/docs/sources/use/builder.rst @@ -40,9 +40,31 @@ build succeeds: ``sudo docker build -t shykes/myapp .`` The Docker daemon will run your steps one-by-one, committing the -result if necessary, before finally outputting the ID of your new -image. The Docker daemon will automatically clean up the context you -sent. +result to a new image if necessary, before finally outputting the +ID of your new image. The Docker daemon will automatically clean +up the context you sent. + +Note that each instruction is run independently, and causes a new image +to be created - so ``RUN cd /tmp`` will not have any effect on the next +instructions. + +Whenever possible, Docker will re-use the intermediate images, +accelerating ``docker build`` significantly (indicated by ``Using cache``: + +.. code-block:: bash + + $ docker build -t SvenDowideit/ambassador . + Uploading context 10.24 kB + Uploading context + Step 1 : FROM docker-ut + ---> cbba202fe96b + Step 2 : MAINTAINER SvenDowideit@home.org.au + ---> Using cache + ---> 51182097be13 + Step 3 : CMD env | grep _TCP= | sed 's/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&/' | sh && top + ---> Using cache + ---> 1a5ffc17324d + Successfully built 1a5ffc17324d When you're done with your build, you're ready to look into :ref:`image_push`.