From b63c10558e6fe187d9cee25a4d8bad4bffd7f79b Mon Sep 17 00:00:00 2001 From: Fred Lifton Date: Tue, 19 Aug 2014 13:39:50 -0700 Subject: [PATCH 1/2] Added warning re: using root for dockerfile root. Fixes #7612 Docker-DCO-1.1-Signed-off-by: Fred Lifton (github: fredlf) --- docs/sources/reference/builder.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md index d2c848b11e..3720a7387c 100644 --- a/docs/sources/reference/builder.md +++ b/docs/sources/reference/builder.md @@ -27,6 +27,19 @@ the build. The build is run by the Docker daemon, not by the CLI, so the whole context must be transferred to the daemon. The Docker CLI reports "Sending build context to Docker daemon" when the context is sent to the daemon. +> **Warning** +> Avoid using your root directory, `/`, as the root of the source repository. The +> `docker build` command will use whatever directory contains the Dockerfile as the build +> context(including all of its subdirectories). The build context will be sent to the +> Docker daemon before building the image, which means if you use `/` as the source +> repository, the entire contents of your hard drive will get sent to the daemon. You +> probably don't want that. + +In most cases, it's best to put each Dockerfile in an empty directory, and then add only +the files needed for building that Dockerfile to that directory. To further speed up the +build, you can exclude files and directories by adding a `.dockerignore` file to the same +directory. + You can specify a repository and tag at which to save the new image if the build succeeds: From 98dd982586ed9fd99853001d4a27503180e432c4 Mon Sep 17 00:00:00 2001 From: Fred Lifton Date: Tue, 19 Aug 2014 17:22:11 -0700 Subject: [PATCH 2/2] Fixed a typo and added a bit based on Sven's feedback Docker-DCO-1.1-Signed-off-by: Fred Lifton (github: fredlf) --- docs/sources/reference/builder.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md index 3720a7387c..796d07d98e 100644 --- a/docs/sources/reference/builder.md +++ b/docs/sources/reference/builder.md @@ -30,10 +30,10 @@ whole context must be transferred to the daemon. The Docker CLI reports > **Warning** > Avoid using your root directory, `/`, as the root of the source repository. The > `docker build` command will use whatever directory contains the Dockerfile as the build -> context(including all of its subdirectories). The build context will be sent to the +> context (including all of its subdirectories). The build context will be sent to the > Docker daemon before building the image, which means if you use `/` as the source -> repository, the entire contents of your hard drive will get sent to the daemon. You -> probably don't want that. +> repository, the entire contents of your hard drive will get sent to the daemon (and +> thus to the machine running the daemon). You probably don't want that. In most cases, it's best to put each Dockerfile in an empty directory, and then add only the files needed for building that Dockerfile to that directory. To further speed up the