Browse code

reinforce that docker build --rm is a good default to use

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@fosiki.com> (github: SvenDowideit)

Sven Dowideit authored on 2014/02/21 12:51:08
Showing 1 changed files
... ...
@@ -197,6 +197,8 @@ is given as ``URL``, then no context is set.  When a Git repository is set as
197 197
 ``URL``, then the repository is used as the context. Git repositories are
198 198
 cloned with their submodules (`git clone --recursive`).
199 199
 
200
+.. note:: ``docker build --rm`` does not affect the image cache which is used to accelerate builds, it only removes the duplicate writeable container layers.
201
+
200 202
 .. _cli_build_examples:
201 203
 
202 204
 .. seealso:: :ref:`dockerbuilder`.
... ...
@@ -206,7 +208,7 @@ Examples:
206 206
 
207 207
 .. code-block:: bash
208 208
 
209
-    $ sudo docker build .
209
+    $ sudo docker build --rm .
210 210
     Uploading context 10240 bytes
211 211
     Step 1 : FROM busybox
212 212
     Pulling repository busybox
... ...
@@ -229,6 +231,9 @@ Examples:
229 229
      ---> Running in 02071fceb21b
230 230
      ---> f52f38b7823e
231 231
     Successfully built f52f38b7823e
232
+    Removing intermediate container 9c9e81692ae9
233
+    Removing intermediate container 02071fceb21b
234
+
232 235
 
233 236
 This example specifies that the ``PATH`` is ``.``, and so all the files in
234 237
 the local directory get tar'd and sent to the Docker daemon.  The ``PATH``
... ...
@@ -243,6 +248,10 @@ The transfer of context from the local machine to the Docker daemon is
243 243
 what the ``docker`` client means when you see the "Uploading context"
244 244
 message.
245 245
 
246
+The ``--rm`` option tells Docker to remove the intermediate containers and 
247
+layers that were used to create each image layer. Doing so has no impact on
248
+the image build cache.
249
+
246 250
 
247 251
 .. code-block:: bash
248 252