Skip to content

Commit

Permalink
Merge #2508
Browse files Browse the repository at this point in the history
2508: Add documentation for .dockerignore r=TomSweeneyRedHat a=rhatdan

<!--
Thanks for sending a pull request!

Please make sure you've read and understood our contributing guidelines
(https://github.com/containers/buildah/blob/master/CONTRIBUTING.md) as well as ensuring
that all your commits are signed with `git commit -s`.
-->

#### What type of PR is this?

<!--
Please label this pull request according to what type of issue you are
addressing, especially if this is a release targeted pull request.

Uncomment only one `/kind <>` line, hit enter to put that in a new line, and
remove leading whitespace from that line:
-->

> /kind api-change
> /kind bug
> /kind cleanup
> /kind deprecation
> /kind design
> /kind documentation
> /kind failing-test 
> /kind feature
> /kind flake
> /kind other

#### What this PR does / why we need it:

#### How to verify it

#### Which issue(s) this PR fixes:

<!--
Automatically closes linked issue when PR is merged.
Uncomment the following comment block and include the issue
number or None on one line.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`, or `None`.
-->

<!--
Fixes #
or
None
-->

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

<!--
If no, just write `None` in the release-note block below. If yes, a release note
is required: Enter your extended release note in the block below. If the PR
requires additional action from users switching to the new release, include the
string "action required".

For more information on release notes please follow the kubernetes model:
https://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note

```



Co-authored-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
bors[bot] and rhatdan authored Aug 6, 2020
2 parents 7123eaa + 69f735b commit 1514dca
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/buildah-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,52 @@ buildah add containerID 'https://github.com/containers/buildah/blob/master/READM

buildah add containerID 'passwd' 'certs.d' /etc

## FILES

### `.dockerignore`

If the file .dockerignore exists in the context directory, `buildah copy` reads
its contents. Buildah uses the content to exclude files and directories from
the context directory, when copying content into the image.

Users can specify a series of Unix shell globals in a .dockerignore file to
identify files to exclude.

Buildah supports a special wildcard string `**` which matches any number of
directories (including zero). For example, **/*.go will exclude all files that
end with .go that are found in all directories.

Example .dockerignore file:

```
# comment
*/temp*
**/temp*
temp?
```

`*/temp*`
Excludes 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*`
Excludes files and directories starting with temp from any subdirectory.

`temp?`
Excludes files and directories in the root directory whose names are a one-character extension of temp. For example, /tempa and /tempb are excluded.

Lines starting with ! (exclamation mark) can be used to make exceptions to
exclusions. The following is an example .dockerignore file that uses this
mechanism:
```
*.md
!README.md
```

All markdown files except README.md are excluded from the context.

For more information see:

https://docs.docker.com/engine/reference/builder/#dockerignore-file

## SEE ALSO
buildah(1)
46 changes: 46 additions & 0 deletions docs/buildah-bud.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,52 @@ are stored while pulling and pushing images. Defaults to '/var/tmp'.

## Files

### `.dockerignore`

If the file .dockerignore exists in the context directory, `buildah bud` reads
its contents. Buildah uses the content to exclude files and directories from
the context directory, when executing COPY and ADD directives in the
Containerfile/Dockerfile

Users can specify a series of Unix shell globals in a .dockerignore file to
identify files to exclude.

Buildah supports a special wildcard string `**` which matches any number of
directories (including zero). For example, **/*.go will exclude all files that
end with .go that are found in all directories.

Example .dockerignore file:

```
# comment
*/temp*
**/temp*
temp?
```

`*/temp*`
Excludes 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*`
Excludes files and directories starting with temp from any subdirectory.

`temp?`
Excludes files and directories in the root directory whose names are a one-character extension of temp. For example, /tempa and /tempb are excluded.

Lines starting with ! (exclamation mark) can be used to make exceptions to
exclusions. The following is an example .dockerignore file that uses this
mechanism:
```
*.md
!README.md
```

All markdown files except README.md are excluded from the context.

For more information see:

https://docs.docker.com/engine/reference/builder/#dockerignore-file

**registries.conf** (`/etc/containers/registries.conf`)

registries.conf is the configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion.
Expand Down
47 changes: 47 additions & 0 deletions docs/buildah-copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,52 @@ buildah copy containerID 'https://github.com/containers/buildah' '/tmp'

buildah copy containerID 'passwd' 'certs.d' /etc

## FILES

### `.dockerignore`

If the file .dockerignore exists in the context directory, `buildah copy` reads
its contents. Buildah uses the content to exclude files and directories from
the context directory, when copying content into the image.

Users can specify a series of Unix shell globals in a .dockerignore file to
identify files to exclude.

Buildah supports a special wildcard string `**` which matches any number of
directories (including zero). For example, **/*.go will exclude all files that
end with .go that are found in all directories.

Example .dockerignore file:

```
# comment
*/temp*
**/temp*
temp?
```

`*/temp*`
Excludes 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*`
Excludes files and directories starting with temp from any subdirectory.

`temp?`
Excludes files and directories in the root directory whose names are a one-character extension of temp. For example, /tempa and /tempb are excluded.

Lines starting with ! (exclamation mark) can be used to make exceptions to
exclusions. The following is an example .dockerignore file that uses this
mechanism:
```
*.md
!README.md
```

All markdown files except README.md are excluded from the context.

For more information see:

https://docs.docker.com/engine/reference/builder/#dockerignore-file

## SEE ALSO
buildah(1)

0 comments on commit 1514dca

Please sign in to comment.