You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/docs/containerignore.5.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,37 +36,41 @@ temp?
36
36
```
37
37
38
38
This file causes the following build behavior:
39
-
Rule Behavior
40
39
41
-
```
42
-
# comment Ignored.
43
-
*/temp* Exclude files and directories whose names start with temp in any immediate subdirectory of the root.
44
-
For example, the plain file /somedir/temporary.txt is excluded, as is the directory /somedir/temp.
45
-
*/*/temp* Exclude files and directories starting with temp from any subdirectory that is two levels below the
46
-
root. For example, /somedir/subdir/temporary.txt is excluded.
47
-
temp? Exclude files and directories in the root directory whose names are a one-character extension of temp. For example, /tempa and /tempb are excluded.
48
-
```
40
+
`#comment`: Lines that start with the `#` character are ignored.
41
+
42
+
`*/temp*`: Exclude files and directories whose names start with temp in any
43
+
immediate subdirectory of the root. For example, the plain file
44
+
/somedir/temporary.txt is excluded, as is the directory /somedir/temp.
45
+
46
+
`*/*/temp*`: Exclude files and directories starting with temp from any
47
+
subdirectory that is two levels below the root. For example,
48
+
/somedir/subdir/temporary.txt is excluded.
49
49
50
-
Matching is done using the golang `path/filepath` package.
50
+
`temp?`: Exclude files and directories in the root directory whose names are a
51
+
one-character extension of temp. For example, /tempa and /tempb are excluded.
51
52
52
-
Match rules:
53
-
* A preprocessing step removes leading and trailing whitespace and eliminates
54
-
. and .. elements using the golang `path/filepath` package.
55
-
* Lines that are blank after preprocessing are ignored.
53
+
54
+
Matching is done using the `filepath.Match` rules:
55
+
56
+
* A preprocessing step removes leading and trailing whitespace and eliminates
57
+
. and .. elements using the golang `path/filepath` package.
58
+
* Lines that are blank after preprocessing are ignored.
56
59
57
60
Beyond the `filepath.Match` rules, Docker also supports a special wildcard
58
61
string `**` that matches any number of directories (including zero). For
59
62
example, `**/*.go` will exclude all files that end with `.go` that are found in
60
63
all directories, including the root of the build context.
61
64
62
65
Lines starting with `!` (exclamation mark) can be used to make exceptions to
63
-
exclusions. The following is an example .containerignore file that uses this
66
+
exclusions. The following is an example `.containerignore` file that uses this
64
67
mechanism:
65
68
66
69
```
67
70
*.md
68
71
!README.md
69
72
```
73
+
70
74
All markdown files except README.md are excluded from the context.
71
75
72
76
The placement of `!` exception rules influences the behavior: the last line of
@@ -78,7 +82,8 @@ included or excluded. Consider the following example:
78
82
!README*.md
79
83
README-secret.md
80
84
```
81
-
No markdown files are included in the context except README files other than README-secret.md.
85
+
86
+
No markdown files are included in the context except `README` files other than `README-secret.md`.
82
87
83
88
Now consider this example:
84
89
@@ -104,4 +109,4 @@ followed by one or more `!` exception patterns.
0 commit comments