[BUG] `start -p <name>` treats an optional (`required: false`) dependency as required
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 22/100
Direzione di ricerca
The required flag is dropped when the project is rebuilt from container labels: pkg/compose/create.go writes the com.docker.compose.depends_on label without it, and projectFromName in pkg/compose/compose.go hard-codes required := true when reading it back. Compare with getProjectWithResources in down.go, which forces Required = false, and check whether start can use the same approach. Done when docker compose -p <name> start starts web after the optional init fails, matching the file-based behaviour; a linked pull request (#14312) already exists, so coordinate with it before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When a service has an optional dependency (depends_on.<svc>.required: false) that fails, docker compose start behaves differently depending on whether the compose file is read:
docker compose start(with the compose file): warnsoptional dependency "init" didn't complete successfullyand startsweb.docker compose -p <name> start(no-f): fails withservice "init" didn't complete successfully: exit 1, andwebis not started.
Expected: -p <name> start treats the dependency as optional too, as it does when the file is read.
Steps To Reproduce
services:
web:
image: alpine:3.21
command: sleep infinity
depends_on:
init:
condition: service_completed_successfully
required: false
init:
image: alpine:3.21
command: sh -c "exit 1"
$ docker compose -p optdep up -d
$ docker compose -p optdep stop
$ docker compose -f compose.yaml -p optdep start # exit 0, web running
$ docker compose -p optdep stop
$ docker compose -p optdep start
Container optdep-init-1 Error service "init" didn't complete successfully: exit 1
service "init" didn't complete successfully: exit 1
$ echo $?
1
$ docker compose -p optdep ps -a --format '{{.Service}} {{.State}}'
init exited
web exited
Compose Version
Docker Compose version v5.6.0-24-g4e1cd3f4e (built from main at 4e1cd3f4e)
Docker Environment
Server Version: 29.1.3
Operating System: Docker Desktop
OSType/Architecture: linux/aarch64
Anything else?
With -p and no -f, the project is rebuilt from container labels (projectFromName), and required is lost on the way:
pkg/compose/create.gowritescom.docker.compose.depends_onasservice:condition:restartonly. The label onwebabove isinit:service_completed_successfully:false.projectFromNameinpkg/compose/compose.goreads it back withrequired := truehard-coded.down/stop/restartalready compensate for this:getProjectWithResourcesindown.goforcesRequired = false.startdoesn't, so-palone works forrestartbut not forstart.
A possible fix: store required as a 4th field of the label and default to true when it is missing (labels written by older versions). #14081 lot 2 (#14296) moves compose start, including the projectFromName path, onto the plan engine, but it doesn't touch this label, so the bug would remain. Happy to send a PR if this direction is fine.
- Lingua principale
- Go
- Stelle
- 38.4k
- Fork
- 5.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 47
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di docker/compose
-
kind/feature
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] docker compose run with `pull_policy: always` has a ruined progress barForse già presa @ndeloof l’ha presa 5 giorni fa. Apertakind/bug
docker/compose#14292 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] `mode` attribute in `configs` works but raises an unsupported warningForse già presa @ndeloof l’ha presa 4 giorni fa. Apertakind/bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
docker/compose#14288 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] pre_start no longer inherits its parent environmentForse già presa @ndeloof l’ha presa 5 giorni fa. Apertakind/bug
docker/compose#14287 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Build fails with fs.read entitlement error when dockerfile is outside the build context (buildx >= 0.37.2)Forse già presa @locker95 l’ha presa 6 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
docker/compose#14285 · 4 commenti · 13 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di docker/compose
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
accepted bug wg/agentic-context
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vllm-project/semantic-router#4922 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Extraction-mode autogen returns pod templates in random order for map-keyed CRDs, so deny and report messages change between runsForse già presa @ManojLamani l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kyverno/kyverno#17980 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
raised-by:reviewer
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
medici-finance/assay#2681 ·
I maintainer di solito rispondono entro 1 giorno
-
bug triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fullsend-ai/fullsend#8353 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno