✦ For everyone, free.

Practical knowledge for real and everyday life

Home

9.4.1.5 Up Detached Mode

A focused guide to Up Detached Mode, connecting core concepts with practical Docker and container operations.

Up detached mode, activated with the -d flag, starts a Compose application's services in the background, returning control of the terminal immediately rather than streaming logs directly, the more commonly used mode for everyday Compose usage.

Starting in Detached Mode

The -d flag is the only change needed from the default foreground invocation.

docker compose up -d

This command returns almost immediately, with the application's services continuing to run in the background.

Why Detached Mode Is the More Common Choice

Most everyday usage doesn't require continuously watching every service's log output directly in the terminal — detached mode frees the terminal for other work while the application continues running.

docker compose up -d
docker compose ps

The terminal is immediately available for further commands, including checking on the application's status, while it continues running in the background.

Viewing Logs Separately When Needed

Detached mode doesn't mean logs are unavailable — they can still be viewed on demand through a separate command.

docker compose logs -f api

This streams api's logs live, available whenever actually needed, without requiring the application itself to have been started in foreground mode.

Stopping a Detached Application

A detached application continues running until explicitly stopped, requiring its own separate command rather than simply being interrupted as a foreground process would be.

docker compose down
Why Up Detached Mode Matters

Detached mode's more practical, background-running behavior makes it the natural default choice for most Compose usage, reserving the foreground, log-streaming mode specifically for situations where continuously watching live log output is genuinely the immediate goal.