Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] `depends_on` health/completion waits always sleep 500ms before the first check

Aperta
#14,384 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@htoyoda18 ci sta già lavorando.

Dal 24/10/2026.

  • #14385 di @htoyoda18 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
docker, go
Ambito
cli

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

kind/bug
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
  1. 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
    
  2. Run docker compose up -d --wait once, so that everything is up and healthy.

  3. Time a no-op run: time docker compose up -d and time 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

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/compose

Tutte le issue di docker/compose

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.