The current documentation correctly states that dockerignore pattern
searches are non-recursive. However, the example given for Markdown
files seems to contradict this by saying that `*.md` will exclude *all*
Markdown files. This commit clarifies the situation by explicitly
specifying that `*.md` will only exclude files in the root directory of
the project.
Signed-off-by: Tim Wraight <tim.wraight@tangentlabs.co.uk>
| ... | ... |
@@ -208,11 +208,11 @@ This file causes the following build behavior: |
| 208 | 208 |
|
| 209 | 209 |
| Rule | Behavior | |
| 210 | 210 |
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 211 |
-| `*/temp*` | Exclude all files with names starting with`temp` in any subdirectory below the root directory. For example, a file named`/somedir/temporary.txt` is ignored. | |
|
| 211 |
+| `*/temp*` | Exclude all files with names starting with`temp` in any subdirectory below the root directory. For example, a file named`/somedir/temporary.txt` is ignored. | |
|
| 212 | 212 |
| `*/*/temp*` | Exclude files starting with name `temp` from any subdirectory that is two levels below the root directory. For example, the file `/somedir/subdir/temporary.txt` is ignored. | |
| 213 |
-| `temp?` | Exclude the files that match the pattern in the root directory. For example, the files `tempa`, `tempb` in the root directory are ignored. | |
|
| 214 |
-| `*.md ` | Exclude all markdown files. | |
|
| 215 |
-| `!LICENSE.md` | Exception to the exclude all Markdown files is this file, `LICENSE.md`, include this file in the build. | |
|
| 213 |
+| `temp?` | Exclude the files that match the pattern in the root directory. For example, the files `tempa`, `tempb` in the root directory are ignored. | |
|
| 214 |
+| `*.md ` | Exclude all markdown files in the root directory. | |
|
| 215 |
+| `!LICENSE.md` | Exception to the Markdown files exclusion is this file, `LICENSE.md`, Include this file in the build. | |
|
| 216 | 216 |
|
| 217 | 217 |
The placement of `!` exception rules influences the matching algorithm; the |
| 218 | 218 |
last line of the `.dockerignore` that matches a particular file determines |
| ... | ... |
@@ -229,8 +229,9 @@ example: |
| 229 | 229 |
``` |
| 230 | 230 |
|
| 231 | 231 |
The build would exclude `LICENSE.md` because the last `*.md` rule adds all |
| 232 |
-Markdown files back onto the ignore list. The `!LICENSE.md` rule has no effect |
|
| 233 |
-because the subsequent `*.md` rule overrides it. |
|
| 232 |
+Markdown files in the root directory back onto the ignore list. The |
|
| 233 |
+`!LICENSE.md` rule has no effect because the subsequent `*.md` rule overrides |
|
| 234 |
+it. |
|
| 234 | 235 |
|
| 235 | 236 |
You can even use the `.dockerignore` file to ignore the `Dockerfile` and |
| 236 | 237 |
`.dockerignore` files. This is useful if you are copying files from the root of |