From b3228085daf16d2649214f7dd2843d5bef530085 Mon Sep 17 00:00:00 2001 From: TastyHeadphones <76083688+TastyHeadphones@users.noreply.github.com> Date: Fri, 25 Sep 2026 10:08:50 +0900 Subject: [PATCH] docs(man): clarify -f is relative to the working directory The build man page said a relative -f path was relative to the context PATH. GetContextFromLocalDir resolves it from the current working directory instead. Spell that out with an example. --- man/docker-build.1.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/man/docker-build.1.md b/man/docker-build.1.md index 0b446a3f85c1..9e6385ed904c 100644 --- a/man/docker-build.1.md +++ b/man/docker-build.1.md @@ -54,12 +54,15 @@ set as the **URL**, the repository is cloned locally and then sent as the contex # OPTIONS **-f**, **--file** *PATH/Dockerfile* - Path to the Dockerfile to use. If the path is a relative path and you are - building from a local directory, then the path must be relative to that - directory. If you are building from a remote URL pointing to either a - tarball or a Git repository, then the path must be relative to the root of - the remote context. In all cases, the file must be within the build context. - The default is *Dockerfile*. + Path to the Dockerfile to use. When building from a local directory, a + relative **-f** path is resolved from the current working directory (not from + the build context *PATH*). For example, `docker build -f Dockerfile subdir` + looks for `./Dockerfile`, not `subdir/Dockerfile`. Use + `docker build -f subdir/Dockerfile subdir` (or omit **-f** so the default + *PATH/Dockerfile* is used) when the Dockerfile lives inside the context. + When building from a remote URL pointing to either a tarball or a Git + repository, the path must be relative to the root of the remote context. + The default is *Dockerfile* inside the build context. **--squash** *true*|*false* **Experimental Only**