浏览代码

Merge pull request #8209 from brahmaroutu/doc_dockerignore_7724

Adding details on how to use .dockerignore file
Sven Dowideit 10 年之前
父节点
当前提交
6df533adb4
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      docs/sources/reference/commandline/cli.md

+ 20 - 0
docs/sources/reference/commandline/cli.md

@@ -231,6 +231,26 @@ Exclusion patterns match files or directories relative to `PATH` that
 will be excluded from the context. Globbing is done using Go's
 [filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
 
+Please note that `.dockerignore` files in other subdirectories are considered as 
+normal files. Filepaths in .dockerignore are absolute with the current directory
+as the root. Wildcards are allowed but the search is not recursive.
+
+### Example .dockerignore file 
+    */temp*
+    */*/temp*
+    temp?
+
+The first line above `*/temp*`, would ignore all files with names starting with
+`temp` from any subdirectory below the root directory, for example file named 
+`/somedir/temporary.txt` will be ignored. The second line `*/*/temp*`, will  
+ignore files starting with name `temp` from any subdirectory that is two levels
+below the root directory, for example a file `/somedir/subdir/temporary.txt` is 
+ignored in this case. The last line in the above example `temp?`, will ignore 
+the files that match the pattern from the root directory, for example files 
+`tempa`, `tempb` are ignored from the root directory. Currently  there is no
+support for regular expressions, formats like `[^temp*]` are ignored.
+
+
 See also:
 
 [*Dockerfile Reference*](/reference/builder).