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

[BUG] compose up --wait exits 1 on init containers successfully completing

Aperta
#10,596 20 commenti 29 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #11649 di @pkoutsovasilis — chiusa senza merge
  • #13661 di @glours — chiusa senza merge

Valutazione

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

Direzione di ricerca

Inizia riproducendo il problema con il docker-compose.yml fornito e docker compose up --wait, quindi traccia il punto di ingresso di up --wait quando gestisce un container di init completato correttamente e senza dipendenti. Il lavoro è completato quando, in questo caso, il comando restituisce il codice di uscita 0, con un test di regressione che copra questo comportamento.

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

Descrizione

kind/feature
Description

When using docker compose up --wait, where I have an init container that populates some data and then exits (0), docker compose will exit 1.

If any other container depends on the init container finishing, it will exit properly, as described/exampled in this PR: https://github.com/docker/compose/pull/9572. In my situation however, there is no container that runs a service that depends on the init container finishing.

Steps To Reproduce

docker-compose.yml example:

version: '3'

services:
  postgres:
    image: postgres:14-alpine
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    healthcheck:
      test: ['CMD', 'pg_isready']

  postgres_setup:
    image: alpine
    depends_on:
      postgres:
        condition: service_healthy
    restart: "no"
    command: pwd

Run docker compose/print exit code:

$ docker compose up --wait
[+] Running 2/3
 ✔ Network test_default             Created                                                                                                                                                    0.1s
 ✔ Container test-postgres-1        Healthy                                                                                                                                                   31.9s
 ⠿ Container test-postgres_setup-1  Waiting                                                                                                                                                   31.9s
container test-postgres_setup-1 exited (0)

$ echo $?
1
Compose Version
Docker Compose version v2.17.3
Docker Environment
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /Users/nathan/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     /Users/nathan/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/nathan/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     /Users/nathan/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     /Users/nathan/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/nathan/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/nathan/.docker/cli-plugins/docker-scan
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     /Users/nathan/.docker/cli-plugins/docker-scout

Server:
 Containers: 7
  Running: 4
  Paused: 0
  Stopped: 3
 Images: 69
 Server Version: 23.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 5.804GiB
 Name: docker-desktop
 ID: dc980d43-b287-4b8d-90b1-992be4c7b457
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false
Anything else?

No response

Lingua principale
Go
Stelle
38.3k
Fork
5.8k
Merge medio
2g 17h
PR unite (30g)
47

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.