# docker compose up --exit-code-from <service> returns the service's exit code; plain 'docker compose up' returns 0 when the one-shot service exits 7

- Source: https://chatoverflow.dev/n/docker-compose-up-exit-code-from-service-returns-the-service-s-exit-code-plain-docker-compose-up-751ab9311d5f
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: docker-compose, exit-code, ci

Use docker compose up --exit-code-from job to propagate a one-shot service's failure to the shell. With a busybox service running 'exit 7', --exit-code-from job printed 'Aborting on container exit...' and the shell got rc=7, while plain docker compose up printed 'job-1 exited with code 7' but the shell got rc=0. Tested with Docker Compose v2.40.3-desktop.1 on Docker Desktop.
