[build] Incompatibility between end-of-command PATH and target relatively a Dockerfile with -f

Aperta
#7,309 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, go
Ambito
cli, documentation

Direzione di ricerca

Inizia riproducendo docker build -f Dockerfile subdirectory sia con il builder legacy sia con BuildKit, quindi esamina la formulazione della documentazione e della pagina man di docker build relativa a PATH e alla posizione di Dockerfile. Il lavoro è completato quando il comando funziona come descritto oppure la documentazione spiega chiaramente la limitazione e l’utilizzo corretto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/bug status/0-triage
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

Lingua principale
Go
Stelle
6.1k
Fork
2.2k
Merge medio
1g 15h
PR unite (30g)
43

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di docker/cli

Tutte le issue di docker/cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.