compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] `docker compose up -d wait` incorrectly returning `1` when all services/jobs reported healthy

Open jamesmcguirepro opened this issue 5 months ago • 3 comments

Description

  1. Set up a docker-compose.yml file that runs several jobs and services.
  2. Run docker compose up -d wait
  3. Have all jobs succeed, and all services come up healthy
  4. Observe return code is incorrectly set to 1
jamesmcguire@MAC-2FHKQ7X compose % docker compose up -d --wait
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AWS_SESSION_TOKEN" variable is not set. Defaulting to a blank string. 
WARN[0000] The "BINDER_URL_SIGNING_SECRET" variable is not set. Defaulting to a blank string. 
WARN[0000] The "NEO4J_HOST_FULL_URL" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_PRIVATE_KEY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_PRIVATE_KEY_PASSPHRASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_ROLE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_USER" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DLM_SNOWFLAKE_SCHEMA" variable is not set. Defaulting to a blank string. 
WARN[0000] The "POSTGRES_HOST" variable is not set. Defaulting to a blank string. 
WARN[0000] The "AWS_SESSION_TOKEN" variable is not set. Defaulting to a blank string. 
WARN[0000] The "BINDER_URL_SIGNING_SECRET" variable is not set. Defaulting to a blank string. 
[+] Running 22/24
 ✔ Network compose_default                                   Created                                                                                                                                                                                                                                          0.0s 
 ✔ Container compose-zookeeper-1                             Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-ui-service-shell-proxy-1                Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-redis-1                                 Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-postgres-1                              Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-elasticsearch-1                         Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-mailcatcher-1                           Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-dynamodb-1                              Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-memcached-1                             Healthy                                                                                                                                                                                                                                        112.7s 
 ✔ Container compose-dynamodb-admin-1                        Healthy                                                                                                                                                                                                                                        112.6s 
 ✔ Container compose-ui-service-shell-1                      Healthy                                                                                                                                                                                                                                        112.6s 
 ✔ Container compose-kafka-1                                 Healthy                                                                                                                                                                                                                                        112.6s 
 ⠼ Container compose-image-processing-1                      Waiting                                                                                                                                                                                                                                        112.6s 
 ✔ Container compose-image-processing-sidekiq-1              Healthy                                                                                                                                                                                                                                        112.6s 
 ✔ Container compose-kafka-ui-1                              Healthy                                                                                                                                                                                                                                        112.5s 
 ✔ Container compose-streaming-topic-management-1            Exited                                                                                                                                                                                                                                         112.5s 
 ✔ Container compose-schema-registry-1                       Healthy                                                                                                                                                                                                                                        112.5s 
 ⠧ Container compose-types-registrar-1                       Waiting                                                                                                                                                                                                                                        112.5s 
 ✔ Container compose-kafka-connect-1                         Healthy                                                                                                                                                                                                                                        112.5s 
 ✔ Container compose-connectable-event-router-jobmanager-1   Healthy                                                                                                                                                                                                                                        112.5s 
 ✔ Container compose-connectable-event-router-taskmanager-1  Healthy                                                                                                                                                                                                                                        112.4s 
 ✔ Container compose-kafka-connect-deployer-1                Exited                                                                                                                                                                                                                                         112.3s 
 ✔ Container compose-flink-router-jobmanager-1               Healthy                                                                                                                                                                                                                                        112.3s 
 ✔ Container compose-flink-router-taskmanager-1              Healthy                                                                                                                                                                                                                                        112.2s 
container compose-types-registrar-1 exited (0)
jamesmcguire@MAC-2FHKQ7X compose % echo $?
1

Steps To Reproduce

No response

Compose Version

% docker compose version     
Docker Compose version v2.38.2-desktop.1

Docker Environment

% docker version             
Client:
 Version:           27.5.1-rd
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        0c97515
 Built:             Thu Jan 23 18:12:38 2025
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.43.2 (199162)
 Engine:
  Version:          28.3.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.5
  Git commit:       e77ff99
  Built:            Wed Jul  9 16:13:56 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Anything else?

No response

jamesmcguirepro avatar Jul 17 '25 21:07 jamesmcguirepro

compose returned 1 as some container exited. docker compose up -d --wait expect services to be running and healthy

ndeloof avatar Jul 18 '25 15:07 ndeloof

compose returned 1 as some container exited. docker compose up -d --wait expect services to be running and healthy

Is there a way to wait until all services are healthy and all jobs have completed successfully (returned exit code 0)?

jamesmcguirepro avatar Jul 18 '25 16:07 jamesmcguirepro

unfortunately: no. Compose doesn't (yet) have an explicit concept for "jobs" which are expected to exit.

ndeloof avatar Jul 21 '25 07:07 ndeloof

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 21 '25 00:12 github-actions[bot]