@@ -60,11 +60,11 @@ pre-packaged tarball contexts and plain text files.
6060
6161When the ` URL ` parameter points to the location of a Git repository, the
6262repository acts as the build context. The system recursively fetches the
63- repository and its submodules. The commit history is not preserved. A
63+ repository and its submodules. The commit history isn't preserved. A
6464repository is first pulled into a temporary directory on your local host. After
6565that succeeds, the directory is sent to the Docker daemon as the context.
6666Local copy gives you the ability to access private repositories using local
67- user credentials, VPN's , and so forth.
67+ user credentials, VPNs , and so forth.
6868
6969> ** Note**
7070>
@@ -100,18 +100,18 @@ contexts:
100100
101101### Tarball contexts
102102
103- If you pass an URL to a remote tarball, the URL itself is sent to the daemon:
103+ If you pass a URL to a remote tarball, the URL itself is sent to the daemon:
104104
105105``` console
106106$ docker build http://server/context.tar.gz
107107```
108108
109109The download operation will be performed on the host the Docker daemon is
110- running on, which is not necessarily the same host from which the build command
110+ running on, which isn't necessarily the same host from which the build command
111111is being issued. The Docker daemon will fetch ` context.tar.gz ` and use it as the
112112build context. Tarball contexts must be tar archives conforming to the standard
113- ` tar ` UNIX format and can be compressed with any one of the 'xz', ' bzip2' ,
114- ' gzip' or ' identity' (no compression) formats.
113+ ` tar ` Unix format and can be compressed with any one of the ` xz ` , ` bzip2 ` ,
114+ ` gzip ` or ` identity ` (no compression) formats.
115115
116116### Text files
117117
@@ -122,7 +122,7 @@ Instead of specifying a context, you can pass a single `Dockerfile` in the
122122$ docker build - < Dockerfile
123123```
124124
125- With Powershell on Windows, you can run:
125+ With PowerShell on Windows, you can run:
126126
127127``` powershell
128128Get-Content Dockerfile | docker build -
@@ -136,8 +136,7 @@ By default the `docker build` command will look for a `Dockerfile` at the root
136136of the build context. The ` -f ` , ` --file ` , option lets you specify the path to
137137an alternative file to use instead. This is useful in cases where the same set
138138of files are used for multiple builds. The path must be to a file within the
139- build context. If a relative path is specified then it is interpreted as
140- relative to the root of the context.
139+ build context. Relative path are interpreted as relative to the root of the context.
141140
142141In most cases, it's best to put each Dockerfile in an empty directory. Then,
143142add to that directory only the files needed for building the Dockerfile. To
@@ -152,8 +151,7 @@ running at the time the build is cancelled, the pull is cancelled as well.
152151
153152## Return code
154153
155- On a successful build, a return code of success ` 0 ` will be returned. When the
156- build fails, a non-zero failure code will be returned.
154+ Successful builds return exit code ` 0 ` . Failed builds return a non-zero exit code.
157155
158156There should be informational output of the reason for failure output to
159157` STDERR ` :
@@ -214,15 +212,15 @@ local directory get `tar`d and sent to the Docker daemon. The `PATH` specifies
214212where to find the files for the "context" of the build on the Docker daemon.
215213Remember that the daemon could be running on a remote machine and that no
216214parsing of the Dockerfile happens at the client side (where you're running
217- ` docker build ` ). That means that * all* the files at ` PATH ` get sent, not just
218- the ones listed to [ * ADD* ] ( https://docs.docker.com/engine/reference/builder/#add )
215+ ` docker build ` ). That means that all the files at ` PATH ` get sent, not just
216+ the ones listed to [ ` ADD ` ] ( https://docs.docker.com/engine/reference/builder/#add )
219217in the Dockerfile.
220218
221219The transfer of context from the local machine to the Docker daemon is what the
222220` docker ` client means when you see the "Sending build context" message.
223221
224222If you wish to keep the intermediate containers after the build is complete,
225- you must use ` --rm=false ` . This does not affect the build cache.
223+ you must use ` --rm=false ` . This doesn't affect the build cache.
226224
227225### Build with URL
228226
@@ -252,7 +250,7 @@ Successfully built 377c409b35e4
252250
253251This sends the URL ` http://server/ctx.tar.gz ` to the Docker daemon, which
254252downloads and extracts the referenced tarball. The ` -f ctx/Dockerfile `
255- parameter specifies a path inside ` ctx.tar.gz ` to the ` Dockerfile ` that is used
253+ parameter specifies a path inside ` ctx.tar.gz ` to the ` Dockerfile ` used
256254to build the image. Any ` ADD ` commands in that ` Dockerfile ` that refers to local
257255paths must be relative to the root of the contents inside ` ctx.tar.gz ` . In the
258256example above, the tarball contains a directory ` ctx/ ` , so the `ADD
@@ -274,7 +272,7 @@ $ docker build - < context.tar.gz
274272```
275273
276274This will build an image for a compressed context read from ` STDIN ` . Supported
277- formats are: bzip2, gzip and xz .
275+ formats are: ` bzip2 ` , ` gzip ` and ` xz ` .
278276
279277### Use a .dockerignore file
280278
@@ -314,7 +312,6 @@ found, the `.dockerignore` file is used if present. Using a Dockerfile based
314312` .dockerignore ` is useful if a project contains multiple Dockerfiles that expect
315313to ignore different sets of files.
316314
317-
318315### <a name =" tag " ></a > Tag an image (-t, --tag)
319316
320317``` console
@@ -375,12 +372,12 @@ the command line.
375372> ** Note**
376373>
377374> ` docker build ` returns a ` no such file or directory ` error if the
378- > file or directory does not exist in the uploaded context. This may
379- > happen if there is no context, or if you specify a file that is
375+ > file or directory doesn't exist in the uploaded context. This may
376+ > happen if there is no context, or if you specify a file that's
380377> elsewhere on the Host system. The context is limited to the current
381378> directory (and its children) for security reasons, and to ensure
382379> repeatable builds on remote Docker hosts. This is also the reason why
383- > ` ADD ../file ` does not work.
380+ > ` ADD ../file ` doesn't work.
384381
385382### <a name =" cgroup-parent " ></a > Use a custom parent cgroup (--cgroup-parent)
386383
@@ -396,7 +393,7 @@ container to be started using those [`--ulimit` flag values](run.md#ulimit).
396393
397394You can use ` ENV ` instructions in a Dockerfile to define variable
398395values. These values persist in the built image. However, often
399- persistence is not what you want. Users want to specify variables differently
396+ persistence isn't what you want. Users want to specify variables differently
400397depending on which host they build an image on.
401398
402399A good example is ` http_proxy ` or source versions for pulling intermediate
@@ -410,7 +407,7 @@ $ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PRO
410407This flag allows you to pass the build-time variables that are
411408accessed like regular environment variables in the ` RUN ` instruction of the
412409Dockerfile. Also, these values don't persist in the intermediate or final images
413- like ` ENV ` values do. You must add ` --build-arg ` for each build argument.
410+ like ` ENV ` values do. You must add ` --build-arg ` for each build argument.
414411
415412Using this flag will not alter the output you see when the ` ARG ` lines from the
416413Dockerfile are echoed during the build process.
@@ -638,15 +635,14 @@ $ docker build --cache-from myname/myapp .
638635#### Overview
639636
640637Once the image is built, squash the new layers into a new image with a single
641- new layer. Squashing does not destroy any existing image, rather it creates a new
638+ new layer. Squashing doesn't destroy any existing image, rather it creates a new
642639image with the content of the squashed layers. This effectively makes it look
643640like all ` Dockerfile ` commands were created with a single layer. The build
644641cache is preserved with this method.
645642
646- The ` --squash ` option is an experimental feature, and should not be considered
643+ The ` --squash ` option is an experimental feature, and shouldn't be considered
647644stable.
648645
649-
650646Squashing layers can be beneficial if your Dockerfile produces multiple layers
651647modifying the same files, for example, files that are created in one step, and
652648removed in another step. For other use-cases, squashing images may actually have
@@ -656,24 +652,23 @@ images (saving space).
656652
657653For most use cases, multi-stage builds are a better alternative, as they give more
658654fine-grained control over your build, and can take advantage of future
659- optimizations in the builder. Refer to the [ use multi-stage builds] ( https://docs.docker.com/develop/develop-images/multistage-build/ )
660- section in the userguide for more information.
661-
655+ optimizations in the builder. Refer to the [ Multi-stage builds] ( https://docs.docker.com/build/building/multi-stage/ )
656+ section for more information.
662657
663658#### Known limitations
664659
665660The ` --squash ` option has a number of known limitations:
666661
667- - When squashing layers, the resulting image cannot take advantage of layer
662+ - When squashing layers, the resulting image can't take advantage of layer
668663 sharing with other images, and may use significantly more space. Sharing the
669664 base image is still supported.
670665- When using this option you may see significantly more space used due to
671666 storing two copies of the image, one for the build cache with all the cache
672667 layers intact, and one for the squashed version.
673668- While squashing layers may produce smaller images, it may have a negative
674669 impact on performance, as a single layer takes longer to extract, and
675- downloading a single layer cannot be parallelized.
676- - When attempting to squash an image that does not make changes to the
670+ downloading a single layer can't be parallelized.
671+ - When attempting to squash an image that doesn't make changes to the
677672 filesystem (for example, the Dockerfile only contains ` ENV ` instructions),
678673 the squash step will fail (see [ issue #33823 ] ( https://github.com/moby/moby/issues/33823 ) ).
679674
@@ -686,7 +681,7 @@ the Docker daemon or setting `experimental: true` in the `daemon.json` configura
686681file.
687682
688683By default, experimental mode is disabled. To see the current configuration of
689- the docker daemon, use the ` docker version ` command and check the ` Experimental `
684+ the Docker daemon, use the ` docker version ` command and check the ` Experimental `
690685line in the ` Engine ` section:
691686
692687``` console
@@ -711,10 +706,10 @@ Server: Docker Engine - Community
711706 [...]
712707```
713708
714- To enable experimental mode, users need to restart the docker daemon with the
709+ To enable experimental mode, users need to restart the Docker daemon with the
715710experimental flag enabled.
716711
717- #### Enable Docker experimental
712+ #### Enable experimental features
718713
719714To enable experimental features, you need to start the Docker daemon with
720715` --experimental ` flag. You can also enable the daemon flag via
735730
736731#### Build an image with ` --squash ` argument
737732
738- The following is an example of docker build with ` --squash ` argument
733+ The following is an example of a build with ` --squash ` argument
739734
740735``` dockerfile
741736FROM busybox
0 commit comments