1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #6798 from tiborvass/docs-dockerignore

More docs for dockerignore
This commit is contained in:
Tibor Vass 2014-07-01 17:23:00 -04:00
commit 1822bf730e
2 changed files with 35 additions and 3 deletions

View file

@ -83,6 +83,38 @@ be treated as an argument. This allows statements like:
Here is the set of instructions you can use in a Dockerfile
for building images.
## .dockerignore
If a file named `.dockerignore` exists in the source repository, then it
is interpreted as a newline-separated list of exclusion patterns.
Exclusion patterns match files or directories relative to the source repository
that will be excluded from the context. Globbing is done using Go's
[filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
The following example shows the use of the `.dockerignore` file to exclude the
`.git` directory from the context. Its effect can be seen in the changed size of
the uploaded context.
$ docker build .
Uploading context 18.829 MB
Uploading context
Step 0 : FROM busybox
---> 769b9341d937
Step 1 : CMD echo Hello World
---> Using cache
---> 99cc1ad10469
Successfully built 99cc1ad10469
$ echo ".git" > .dockerignore
$ docker build .
Uploading context 6.76 MB
Uploading context
Step 0 : FROM busybox
---> 769b9341d937
Step 1 : CMD echo Hello World
---> Using cache
---> 99cc1ad10469
Successfully built 99cc1ad10469
## FROM
FROM <image>

View file

@ -223,7 +223,7 @@ will be excluded from the context. Globbing is done using Go's
See also:
[*Dockerfile Reference*](/reference/builder/#dockerbuilder).
[*Dockerfile Reference*](/reference/builder).
### Examples:
@ -292,8 +292,8 @@ affect the build cache.
---> 99cc1ad10469
Successfully built 99cc1ad10469
This example shows the use of the ``.dockerignore`` file to exclude the ``.git``
directory the context. Its effect can be seen in the changed size of the
This example shows the use of the `.dockerignore` file to exclude the `.git`
directory from the context. Its effect can be seen in the changed size of the
uploaded context.
$ sudo docker build -t vieux/apache:2.0 .