Menu

Restart a dependent Compose app after an explicit backend restart
📰

Restart a dependent Compose app after an explicit backend restart

DEV Community: docker·Chris Rodriguez·4 days ago
#oACYyM8d
#devtodocker#devto#dev#restart#compose
Reading 0:00
15s threshold

A Compose stack can be correct at startup yet become stale after maintenance. If an operator deliberately restarts a backend, the dependent app may continue running with an old socket, connection pool, cached credential, or other backend-facing process state. More startup delays do not address that later lifecycle event.

The implementation decision is to place restart propagation on the dependency edge. Configure the app with long-form depends_on for its backend and enable the dependency restart option there. Keep that setting separate from each service’s restart policy. A policy such as always or unless-stopped controls whether a service returns after its own container exits; it does not tell Compose to restart downstream services when a backend is intentionally restarted.

The inserted example models a backend and an app, then validates two pieces of declared intent: the requested operation is an explicit Compose restart of an existing dependency, and at least one dependent opts into restart propagation.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.