[build] Incompatibility between end-of-command PATH and target relatively a Dockerfile with -f
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- docker, go
- Domain
- cli, documentation
Research direction
Start by reproducing docker build -f Dockerfile subdirectory with both the legacy builder and BuildKit, then inspect the docker build documentation and manpage wording about PATH and Dockerfile location. Done means either the command works as described or the documentation clearly explains the limitation and correct usage.
Written by the indexing model from the issue text.
Description
Description
docker build allows to provide a PATH at the end of the command to locate the Dockerfile there, or to target a Dockerfile with - f.
Reading at the documentation/manpage, it leads to think PATH becomes the working directory, and as such if we combine both we could use -f to target the Dockerfile relatively to PATH.
Reproduce
Picture this structure:
repo_root
|___subdirectory
|____Dockerfile
One would expect here that we could be at repo_root and run docker build -f Dockerfile subdirectory as Dockerfile is at current location (.) when starting from subdirectory.
That's what lead to think the manpage.
The result however is this: ERROR: failed to build: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
Note that although the error message is different, the issue exist for both legacy builder and BuildKit.
Expected behavior
The example given above should work, or if it's expected that it doesn't, the manpage might need a little rewording.
docker version
What's provided in GitHub Actions context first, then reproduced on an ArchLinux computer I don't have at hand to paste the block. Docker 29.8.0 on Arch (https://archlinux.org/packages/extra/x86_64/docker/) reproduced with legacy builder and BuildKit one (https://archlinux.org/packages/extra/x86_64/docker-buildx/)
docker info
Same as above, don't need to have the build running anyway.
Additional Info
No response
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 47
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docker/cli
-
kind/bug status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
kind/bug status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
kind/feature status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
kind/bug status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Similar issues
-
textual definition
Difficulty 1/5 Under an hour Newbie friendliness 90/100
geneontology/go-ontology#32653 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
needs design
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100