mirror of https://github.com/docker/cli.git
Add support for comment in .dockerignore
This fix tries to address the issue raised in #20083 where comment is not supported in `.dockerignore`. This fix updated the processing of `.dockerignore` so that any lines starting with `#` are ignored, which is similiar to the behavior of `.gitignore`. Related documentation has been updated. Additional tests have been added to cover the changes. This fix fixes #20083. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
54df0949b0
commit
1a22098ae2
|
@ -379,9 +379,13 @@ the working and the root directory. For example, the patterns
|
|||
in the `foo` subdirectory of `PATH` or in the root of the git
|
||||
repository located at `URL`. Neither excludes anything else.
|
||||
|
||||
If a line in `.dockerignore` file starts with `#` in column 1, then this line is
|
||||
considered as a comment and is ignored before interpreted by the CLI.
|
||||
|
||||
Here is an example `.dockerignore` file:
|
||||
|
||||
```
|
||||
# comment
|
||||
*/temp*
|
||||
*/*/temp*
|
||||
temp?
|
||||
|
@ -391,6 +395,7 @@ This file causes the following build behavior:
|
|||
|
||||
| Rule | Behavior |
|
||||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `# comment` | Ignored. |
|
||||
| `*/temp*` | Exclude files and directories whose names start with `temp` in any immediate subdirectory of the root. For example, the plain file `/somedir/temporary.txt` is excluded, as is the directory `/somedir/temp`. |
|
||||
| `*/*/temp*` | Exclude files and directories starting with `temp` from any subdirectory that is two levels below the root. For example, `/somedir/subdir/temporary.txt` is excluded. |
|
||||
| `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.
|
||||
|
|
Loading…
Reference in New Issue