Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 94739e3

Browse files
tonistiigithaJeztah
authored andcommitted
docs: document dockerignore update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 4f3bc15817b3f86f8c3d25df2389da253655c071) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 7bfe3d20063f3986fb5c61be48b87c6b8d2b87e9 Component: cli
1 parent 49c91f0 commit 94739e3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • components/cli/docs/reference/commandline

components/cli/docs/reference/commandline/build.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,16 @@ Successfully built 99cc1ad10469
324324
This example shows the use of the `.dockerignore` file to exclude the `.git`
325325
directory from the context. Its effect can be seen in the changed size of the
326326
uploaded context. The builder reference contains detailed information on
327-
[creating a .dockerignore file](../builder.md#dockerignore-file)
327+
[creating a .dockerignore file](../builder.md#dockerignore-file).
328+
329+
When using the [BuildKit backend](../builder.md#buildkit), `docker build` searches
330+
for a `.dockerignore` file relative to the Dockerfile name. For example, running
331+
`docker build -f myapp.Dockerfile .` will first look for an ignore file named
332+
`myapp.Dockerfile.dockerignore`. If such a file is not found, the `.dockerignore`
333+
file is used if present. Using a Dockerfile based `.dockerignore` is useful if a
334+
project contains multiple Dockerfiles that expect to ignore different sets of
335+
files.
336+
328337

329338
### Tag an image (-t)
330339

0 commit comments

Comments
 (0)