-
Notifications
You must be signed in to change notification settings - Fork 54
common: Cleanup manpage formatting #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
siretart
wants to merge
1
commit into
containers:main
Choose a base branch
from
siretart:manpage-fixes-common
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,32 @@ | ||
| % ".containerignore" "28" "Sep 2021" "" "Container User Manuals" | ||
| % ".containerignore" "5" "Sep 2021" "" "Container User Manuals" | ||
|
|
||
| # NAME | ||
|
|
||
| .containerignore(.dockerignore) - files to ignore buildah or podman build context directory | ||
|
|
||
| # INTRODUCTION | ||
|
|
||
| Before container engines build an image, they look for a file named .containerignore or .dockerignore in the root | ||
| context directory. If one of these file exists, the CLI modifies the context to exclude files and | ||
| directories that match patterns specified in the file. This avoids adding them to images using the ADD or COPY | ||
| instruction. | ||
|
|
||
| The CLI interprets the .containerignore or .dockerignore file as a newline-separated list of patterns similar to | ||
| the file globs of Unix shells. For the purposes of matching, the root of the context is considered to be both the | ||
| working and the root directory. For example, the patterns /foo/bar and foo/bar both exclude a file or directory | ||
| named bar in the foo subdirectory of PATH or in the root of the git repository located at URL. Neither excludes | ||
| Before container engines build an image, they look for a file named | ||
| `.containerignore` or `.dockerignore` in the root context directory. If one of | ||
| these file exists, the CLI modifies the context to exclude files and | ||
| directories that match patterns specified in the file. This avoids adding them | ||
| to images using the ADD or COPY instruction. | ||
mtrmac marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The CLI interprets the `.containerignore` or `.dockerignore` file as a | ||
| newline-separated list of patterns similar to the file globs of Unix | ||
| shells. For the purposes of matching, the root of the context is considered to | ||
| be both the working and the root directory. For example, the patterns `/foo/bar` | ||
| and `foo/bar` both exclude a file or directory named bar 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 .containerignore or .dockerignore file starts with # in column 1, then this line is considered as a | ||
| comment and is ignored before interpreted by the CLI. | ||
| If a line in `.containerignore` or `.dockerignore` file starts with `#` in | ||
| column 1, then this line is considered as a comment and is ignored before | ||
| interpreted by the CLI. | ||
|
|
||
| # EXAMPLES | ||
|
|
||
| Here is an example .containerignore file: | ||
| Here is an example `.containerignore` file: | ||
|
|
||
| ``` | ||
| # comment | ||
|
|
@@ -32,56 +36,77 @@ temp? | |
| ``` | ||
|
|
||
| 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. | ||
| ``` | ||
| Matching is done using Go’s filepath.Match rules. A preprocessing step removes leading and trailing whitespace and | ||
| eliminates . and .. elements using Go’s filepath.Clean. Lines that are blank after preprocessing are ignored. | ||
|
|
||
| Beyond Go’s filepath.Match rules, Docker also supports a special wildcard string ** that matches any number of | ||
| directories (including zero). For example, **/*.go will exclude all files that end with .go that are found in all | ||
| directories, including the root of the build context. | ||
| `#comment`: Lines that start with the `#` character are 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. | ||
|
|
||
|
|
||
| Matching is done using the `filepath.Match` rules: | ||
|
|
||
| * A preprocessing step removes leading and trailing whitespace and eliminates | ||
| . and .. elements using the golang `path/filepath` package. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (If this should be referring to Go’s implementation details at all — arguably that’s not very useful to users, but I think rewording all of this would be a different PR), |
||
| * Lines that are blank after preprocessing are ignored. | ||
|
|
||
| Beyond the `filepath.Match` rules, Docker also supports a special wildcard | ||
| string `**` that matches any number of directories (including zero). For | ||
| example, `**/*.go` will exclude all files that end with `.go` that are found in | ||
| all directories, including the root of the build context. | ||
|
|
||
| Lines starting with `!` (exclamation mark) can be used to make exceptions to | ||
| exclusions. The following is an example `.containerignore` file that uses this | ||
| mechanism: | ||
|
|
||
| Lines starting with ! (exclamation mark) can be used to make exceptions to exclusions. The following is an example .containerignore file that uses this mechanism: | ||
| ``` | ||
| *.md | ||
| !README.md | ||
| ``` | ||
|
|
||
| All markdown files except README.md are excluded from the context. | ||
|
|
||
| The placement of ! exception rules influences the behavior: the last line of the .containerignore that matches a | ||
| particular file determines whether it is included or excluded. Consider the following example: | ||
| The placement of `!` exception rules influences the behavior: the last line of | ||
| the `.containerignore` that matches a particular file determines whether it is | ||
| included or excluded. Consider the following example: | ||
|
|
||
| ``` | ||
| *.md | ||
| !README*.md | ||
| README-secret.md | ||
| ``` | ||
| No markdown files are included in the context except README files other than README-secret.md. | ||
|
|
||
| No markdown files are included in the context except `README` files other than `README-secret.md`. | ||
|
|
||
| Now consider this example: | ||
|
|
||
| ``` | ||
| *.md | ||
| README-secret.md | ||
| !README*.md | ||
| ``` | ||
| All of the README files are included. The middle line has no effect because !README*.md matches README-secret.md and | ||
| comes last. | ||
|
|
||
| You can even use the .containerignore file to exclude the Containerfile or Dockerfile and .containerignore files. | ||
| These files are still sent to the daemon because it needs them to do its job. But the ADD and COPY instructions do | ||
| not copy them to the image. | ||
| All of the README files are included. The middle line has no effect because | ||
| `!README*.md` matches `README-secret.md` and comes last. | ||
|
|
||
| You can even use the .containerignore file to exclude the `Containerfile` or | ||
| `Dockerfile` and `.containerignore` files. These files are still sent to the | ||
| daemon because it needs them to do its job. But the `ADD` and `COPY` instructions | ||
| do not copy them to the image. | ||
|
|
||
| Finally, you may want to specify which files to include in the context, rather than which to exclude. To achieve | ||
| this, specify * as the first pattern, followed by one or more ! exception patterns. | ||
| Finally, you may want to specify which files to include in the context, rather | ||
| than which to exclude. To achieve this, specify `*` as the first pattern, | ||
| followed by one or more `!` exception patterns. | ||
|
|
||
| ## SEE ALSO | ||
| buildah-build(1), podman-build(1), docker-build(1) | ||
|
|
||
| # HISTORY | ||
| *Sep 2021, Compiled by Dan Walsh (dwalsh at redhat dot com) based on docker.com .dockerignore documentation. | ||
| *Sep 2021, Compiled by Dan Walsh (dwalsh at redhat dot com) based on docker.com `.dockerignore` documentation. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are conceptually a description of the
relabel=options, so should be nested under those bullet points (as opposed to theOptions specific to *tmpfs*line below, which is “higher level” than the bullet points).So, I think these should be indented one level; that seems to make a difference for GitHub rendering, but I’m afraid creates exactly the same man page content, so it does not help there. Maybe I’m missing a trick. If not, using a more precise markup means we can hope for md2man improvements in the future.