Menu

Start Docker Compose with an optional dependency using profiles
📰

Start Docker Compose with an optional dependency using profiles

DEV Community: docker·Chris Rodriguez·10 days ago
#lrFzPF46
#devtodocker#devto#dev#telemetry#compose
Long article (766 words) — no AI summary yet.
Reading 0:00
15s threshold

Optional is not the same as unready

A Compose dependency can fail for two separate reasons: the provider exists but is not ready, or the provider is deliberately absent for this run. Health-based conditions address the first case. They do not make an absent service optional.

For an integration such as telemetry, place the integration service behind a named profile. When that profile is not enabled, Compose leaves the service out of the active model. This keeps the definition in the same configuration while making participation an explicit operator choice.

Then use long-form depends_on on the consuming application and mark that dependency as non-required.…

Continue reading — create a free account

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