Browse code

Merge pull request #8209 from brahmaroutu/doc_dockerignore_7724

Adding details on how to use .dockerignore file

Sven Dowideit authored on 2014/09/26 09:53:36
Showing 1 changed files
... ...
@@ -231,6 +231,26 @@ Exclusion patterns match files or directories relative to `PATH` that
231 231
 will be excluded from the context. Globbing is done using Go's
232 232
 [filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
233 233
 
234
+Please note that `.dockerignore` files in other subdirectories are considered as 
235
+normal files. Filepaths in .dockerignore are absolute with the current directory
236
+as the root. Wildcards are allowed but the search is not recursive.
237
+
238
+### Example .dockerignore file 
239
+    */temp*
240
+    */*/temp*
241
+    temp?
242
+
243
+The first line above `*/temp*`, would ignore all files with names starting with
244
+`temp` from any subdirectory below the root directory, for example file named 
245
+`/somedir/temporary.txt` will be ignored. The second line `*/*/temp*`, will  
246
+ignore files starting with name `temp` from any subdirectory that is two levels
247
+below the root directory, for example a file `/somedir/subdir/temporary.txt` is 
248
+ignored in this case. The last line in the above example `temp?`, will ignore 
249
+the files that match the pattern from the root directory, for example files 
250
+`tempa`, `tempb` are ignored from the root directory. Currently  there is no
251
+support for regular expressions, formats like `[^temp*]` are ignored.
252
+
253
+
234 254
 See also:
235 255
 
236 256
 [*Dockerfile Reference*](/reference/builder).