Merge pull request #4273 from SvenDowideit/docker-build-rm

reinforce that docker build --rm is a good default to use
This commit is contained in:
James Turnbull 2014-02-20 23:42:57 -05:00
Родитель a5515d27e5 e59485e148
Коммит 4f20538f73
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -197,6 +197,8 @@ is given as ``URL``, then no context is set. When a Git repository is set as
``URL``, then the repository is used as the context. Git repositories are ``URL``, then the repository is used as the context. Git repositories are
cloned with their submodules (`git clone --recursive`). cloned with their submodules (`git clone --recursive`).
.. note:: ``docker build --rm`` does not affect the image cache which is used to accelerate builds, it only removes the duplicate writeable container layers.
.. _cli_build_examples: .. _cli_build_examples:
.. seealso:: :ref:`dockerbuilder`. .. seealso:: :ref:`dockerbuilder`.
@ -206,7 +208,7 @@ Examples:
.. code-block:: bash .. code-block:: bash
$ sudo docker build . $ sudo docker build --rm .
Uploading context 10240 bytes Uploading context 10240 bytes
Step 1 : FROM busybox Step 1 : FROM busybox
Pulling repository busybox Pulling repository busybox
@ -229,6 +231,9 @@ Examples:
---> Running in 02071fceb21b ---> Running in 02071fceb21b
---> f52f38b7823e ---> f52f38b7823e
Successfully built f52f38b7823e Successfully built f52f38b7823e
Removing intermediate container 9c9e81692ae9
Removing intermediate container 02071fceb21b
This example specifies that the ``PATH`` is ``.``, and so all the files in This example specifies that the ``PATH`` is ``.``, and so all the files in
the local directory get tar'd and sent to the Docker daemon. The ``PATH`` 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
what the ``docker`` client means when you see the "Uploading context" what the ``docker`` client means when you see the "Uploading context"
message. message.
The ``--rm`` option tells Docker to remove the intermediate containers and
layers that were used to create each image layer. Doing so has no impact on
the image build cache.
.. code-block:: bash .. code-block:: bash