From 4f3bc15817b3f86f8c3d25df2389da253655c071 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 24 May 2019 12:07:52 -0700 Subject: [PATCH] docs: document dockerignore update Signed-off-by: Tonis Tiigi Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/build.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reference/commandline/build.md b/docs/reference/commandline/build.md index 46f85fe8a0..d536693c02 100644 --- a/docs/reference/commandline/build.md +++ b/docs/reference/commandline/build.md @@ -324,7 +324,16 @@ Successfully built 99cc1ad10469 This example shows the use of the `.dockerignore` file to exclude the `.git` directory from the context. Its effect can be seen in the changed size of the uploaded context. The builder reference contains detailed information on -[creating a .dockerignore file](../builder.md#dockerignore-file) +[creating a .dockerignore file](../builder.md#dockerignore-file). + +When using the [BuildKit backend](../builder.md#buildkit), `docker build` searches +for a `.dockerignore` file relative to the Dockerfile name. For example, running +`docker build -f myapp.Dockerfile .` will first look for an ignore file named +`myapp.Dockerfile.dockerignore`. If such a file is not found, the `.dockerignore` +file is used if present. Using a Dockerfile based `.dockerignore` is useful if a +project contains multiple Dockerfiles that expect to ignore different sets of +files. + ### Tag an image (-t)