Browse code

Merge pull request #4292 from cpuguy83/4291_make_rm_default_for_build

make docker build -rm=true default

unclejack authored on 2014/02/27 02:03:59
Showing 3 changed files
... ...
@@ -32,10 +32,10 @@ shell: build
32 32
 	$(DOCKER_RUN_DOCKER) bash
33 33
 
34 34
 build: bundles
35
-	docker build -rm -t "$(DOCKER_IMAGE)" .
35
+	docker build -t "$(DOCKER_IMAGE)" .
36 36
 
37 37
 docs-build:
38
-	docker build -rm -t "$(DOCKER_DOCS_IMAGE)" docs
38
+	docker build -t "$(DOCKER_DOCS_IMAGE)" docs
39 39
 
40 40
 bundles:
41 41
 	mkdir bundles
... ...
@@ -138,7 +138,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
138 138
 	tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) to be applied to the resulting image in case of success")
139 139
 	suppressOutput := cmd.Bool([]string{"q", "-quiet"}, false, "Suppress the verbose output generated by the containers")
140 140
 	noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
141
-	rm := cmd.Bool([]string{"#rm", "-rm"}, false, "Remove intermediate containers after a successful build")
141
+	rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
142 142
 	if err := cmd.Parse(args); err != nil {
143 143
 		return nil
144 144
 	}
... ...
@@ -185,11 +185,11 @@ Examples:
185 185
 
186 186
     Usage: docker build [OPTIONS] PATH | URL | -
187 187
     Build a new container image from the source code at PATH
188
-      -t, --time="": Repository name (and optionally a tag) to be applied 
188
+      -t, --time="": Repository name (and optionally a tag) to be applied
189 189
              to the resulting image in case of success.
190 190
       -q, --quiet=false: Suppress the verbose output generated by the containers.
191 191
       --no-cache: Do not use the cache when building the image.
192
-      --rm: Remove intermediate containers after a successful build
192
+      --rm=true: Remove intermediate containers after a successful build
193 193
 
194 194
 The files at ``PATH`` or ``URL`` are called the "context" of the build. The
195 195
 build process may refer to any of the files in the context, for example when
... ...
@@ -198,8 +198,6 @@ is given as ``URL``, then no context is set.  When a Git repository is set as
198 198
 ``URL``, then the repository is used as the context. Git repositories are
199 199
 cloned with their submodules (`git clone --recursive`).
200 200
 
201
-.. note:: ``docker build --rm`` does not affect the image cache which is used to accelerate builds, it only removes the duplicate writeable container layers.
202
-
203 201
 .. _cli_build_examples:
204 202
 
205 203
 .. seealso:: :ref:`dockerbuilder`.
... ...
@@ -209,7 +207,7 @@ Examples:
209 209
 
210 210
 .. code-block:: bash
211 211
 
212
-    $ sudo docker build --rm .
212
+    $ sudo docker build .
213 213
     Uploading context 10240 bytes
214 214
     Step 1 : FROM busybox
215 215
     Pulling repository busybox
... ...
@@ -249,9 +247,8 @@ The transfer of context from the local machine to the Docker daemon is
249 249
 what the ``docker`` client means when you see the "Uploading context"
250 250
 message.
251 251
 
252
-The ``--rm`` option tells Docker to remove the intermediate containers and 
253
-layers that were used to create each image layer. Doing so has no impact on
254
-the image build cache.
252
+If you wish to keep the intermediate containers after the build is complete,
253
+you must use ``--rm=false``. This does not affect the build cache.
255 254
 
256 255
 
257 256
 .. code-block:: bash