[build] Incompatibility between end-of-command PATH and target relatively a Dockerfile with -f
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
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
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.
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.
Assessment
- Tech stack
- docker, go
- Domain
- cli, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100