Skip to content

Commit

Permalink
Add documentation for .dockerignore
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Aug 6, 2020
1 parent b55e22a commit 69f735b
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 69f735b

Please sign in to comment.