more docs for dockerignore

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
This commit is contained in:
Tibor Vass 2014-07-01 15:03:07 -04:00 committed by Tibor Vass
parent db5c70afe4
commit e7e6ff5e6f
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 .