[BUG] `depends_on` health/completion waits always sleep 500ms before the first check
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
Direzione di ricerca
The cause is already pinpointed: the wait loop in pkg/compose/service_containers.go ticks on a 500ms time.Ticker before its first dependency check, so it sleeps even when the dependency is already healthy. Read waitDependency and restructure the loop to check first, then wait for the next tick; 'done' is a no-op docker compose up -d --wait timing near ~0.07s. Note: open pull request #14385 already targets this, so the work is underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When a service waits on a dependency with condition: service_healthy or service_completed_successfully, Compose always waits 500ms before it checks the dependency for the first time, even when the dependency is already healthy. up --wait pays this delay again in its final check. As a result, a no-op docker compose up -d takes ~0.6s instead of ~0.07s, and up -d --wait takes ~1.1s instead of ~0.07s.
The cause is waitDependency in pkg/compose/service_containers.go: the loop waits on a 500ms time.Ticker before the first check. The loop has had this shape since 2021.
Steps To Reproduce
-
Create compose.yaml
services: db: image: alpine:3.20 command: sleep infinity init: true healthcheck: test: ["CMD", "true"] interval: 1s start_interval: 1s start_period: 5s app: image: alpine:3.20 command: sleep infinity init: true depends_on: db: condition: service_healthy -
Run
docker compose up -d --waitonce, so that everything is up and healthy. -
Time a no-op run:
time docker compose up -dandtime docker compose up -d --wait.
Compose Version
Docker Compose version v5.6.1
Docker Environment
Anything else?
No response
- Lingua principale
- Go
- Stelle
- 38.5k
- Fork
- 5.9k
- Merge medio
- 2g 19h
- PR unite (30g)
- 77
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
-
[BUG] deploy.restart_policy without condition drops the restart policyForse già presa @akshat-lakhera l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
docker/compose#14383 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] A start failure in one service aborts the start of unrelated services (unreleased regression)Apertakind/bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
docker/compose#14372 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Support OSC 7501 progressApertakind/feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
docker/compose#14365 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
kind/feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
docker/compose#14356 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Epic: Move service selection into the backend API instead of pre-filtering the project in the CLIAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
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 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 76/100
superplanehq/superplane#9007 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
yetone/magpie#3905 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno