浏览代码

make docker build -rm=true default #4292

Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
Brian Goff 11 年之前
父节点
当前提交
0b4aeb79d9
共有 3 个文件被更改,包括 8 次插入11 次删除
  1. 2 2
      Makefile
  2. 1 1
      api/client.go
  3. 5 8
      docs/sources/reference/commandline/cli.rst

+ 2 - 2
Makefile

@@ -32,10 +32,10 @@ shell: build
 	$(DOCKER_RUN_DOCKER) bash
 	$(DOCKER_RUN_DOCKER) bash
 
 
 build: bundles
 build: bundles
-	docker build -rm -t "$(DOCKER_IMAGE)" .
+	docker build -t "$(DOCKER_IMAGE)" .
 
 
 docs-build:
 docs-build:
-	docker build -rm -t "$(DOCKER_DOCS_IMAGE)" docs
+	docker build -t "$(DOCKER_DOCS_IMAGE)" docs
 
 
 bundles:
 bundles:
 	mkdir bundles
 	mkdir bundles

+ 1 - 1
api/client.go

@@ -138,7 +138,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
 	tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) to be applied to the resulting image in case of success")
 	tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) to be applied to the resulting image in case of success")
 	suppressOutput := cmd.Bool([]string{"q", "-quiet"}, false, "Suppress the verbose output generated by the containers")
 	suppressOutput := cmd.Bool([]string{"q", "-quiet"}, false, "Suppress the verbose output generated by the containers")
 	noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
 	noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
-	rm := cmd.Bool([]string{"#rm", "-rm"}, false, "Remove intermediate containers after a successful build")
+	rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
 	if err := cmd.Parse(args); err != nil {
 	if err := cmd.Parse(args); err != nil {
 		return nil
 		return nil
 	}
 	}

+ 5 - 8
docs/sources/reference/commandline/cli.rst

@@ -184,11 +184,11 @@ Examples:
 
 
     Usage: docker build [OPTIONS] PATH | URL | -
     Usage: docker build [OPTIONS] PATH | URL | -
     Build a new container image from the source code at PATH
     Build a new container image from the source code at PATH
-      -t, --time="": Repository name (and optionally a tag) to be applied 
+      -t, --time="": Repository name (and optionally a tag) to be applied
              to the resulting image in case of success.
              to the resulting image in case of success.
       -q, --quiet=false: Suppress the verbose output generated by the containers.
       -q, --quiet=false: Suppress the verbose output generated by the containers.
       --no-cache: Do not use the cache when building the image.
       --no-cache: Do not use the cache when building the image.
-      --rm: Remove intermediate containers after a successful build
+      --rm=true: Remove intermediate containers after a successful build
 
 
 The files at ``PATH`` or ``URL`` are called the "context" of the build. The
 The files at ``PATH`` or ``URL`` are called the "context" of the build. The
 build process may refer to any of the files in the context, for example when
 build process may refer to any of the files in the context, for example when
@@ -197,8 +197,6 @@ 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`.
@@ -208,7 +206,7 @@ Examples:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ sudo docker build --rm .
+    $ sudo docker build .
     Uploading context 10240 bytes
     Uploading context 10240 bytes
     Step 1 : FROM busybox
     Step 1 : FROM busybox
     Pulling repository busybox
     Pulling repository busybox
@@ -248,9 +246,8 @@ 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.
+If you wish to keep the intermediate containers after the build is complete,
+you must use ``--rm=false``. This does not affect the build cache.
 
 
 
 
 .. code-block:: bash
 .. code-block:: bash