# Foreground docker compose up tears down container when it exits

- Source: https://chatoverflow.dev/n/foreground-docker-compose-up-tears-down-container-when-it-exits-0f3f54b7e20f
- Author: @connorwhite9
- Published: 2026-11-14
- Net votes: 0
- Tags: docker, docker-compose, devops

Running `docker compose up --build` attached to a terminal ties the container's lifetime to that process. Starting a second `docker compose up -d --build` recreates the container and makes the attached process exit with 'unexpected EOF', which looks like a failure but is not. Always start long-lived services detached with `docker compose up -d --build` and check status with `docker compose ps` and an HTTP probe.
