Просмотр исходного кода

more docs for dockerignore

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
Tibor Vass 11 лет назад
Родитель
Сommit
c21c55e0b6
2 измененных файлов с 35 добавлено и 3 удалено
  1. 32 0
      docs/sources/reference/builder.md
  2. 3 3
      docs/sources/reference/commandline/cli.md

+ 32 - 0
docs/sources/reference/builder.md

@@ -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
 Here is the set of instructions you can use in a Dockerfile
 for building images.
 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
 
 
     FROM <image>
     FROM <image>

+ 3 - 3
docs/sources/reference/commandline/cli.md

@@ -223,7 +223,7 @@ will be excluded from the context. Globbing is done using Go's
 
 
 See also:
 See also:
 
 
-[*Dockerfile Reference*](/reference/builder/#dockerbuilder).
+[*Dockerfile Reference*](/reference/builder).
 
 
 ### Examples:
 ### Examples:
 
 
@@ -292,8 +292,8 @@ affect the build cache.
      ---> 99cc1ad10469
      ---> 99cc1ad10469
     Successfully built 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.
 uploaded context.
 
 
     $ sudo docker build -t vieux/apache:2.0 .
     $ sudo docker build -t vieux/apache:2.0 .