Skip to content

healthcheck and depends_on service_healthy are silently ignored #117

Description

@thromel

Summary

healthcheck and depends_on.condition: service_healthy are parsed without an error, but the dependent service starts immediately and the healthcheck does not appear to be represented in the created container configuration.

Environment

- OS: macOS 26.5.1 (25F80)
- Xcode: 26.5 (17F42)
- container: 1.0.0 (release, commit ee848e3)
- container-compose: 1.0.0 installed via Homebrew
- Architecture: arm64

Reproduction

compose.yml:

services:
  web:
    image: nginx:alpine
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1"]
      interval: 1s
      timeout: 1s
      retries: 5

  probe:
    image: busybox:latest
    depends_on:
      web:
        condition: service_healthy
    command: ["sh", "-c", "echo PROBE_STARTED"]

Run:

container-compose --file compose.yml up -d
container logs health-probe
container inspect health-web

Actual behavior

probe starts immediately:

PROBE_STARTED

container inspect health-web did not show healthcheck metadata or a health status field.

Expected behavior

For Compose compatibility, one of these should happen:

  1. container-compose implements healthcheck execution and waits for service_healthy before starting dependents.
  2. If this requires upstream apple/container healthcheck primitives, container-compose reports a clear unsupported-feature warning/error instead of silently ignoring the condition.

Silent ignore is risky because stacks can appear to start while dependencies are not actually ready.

Activity

  1. ryan106 commented on Jul 2, 2026

    @ryan106
    Contributor

    This also looks fixed (likely by #119, same as #115/#52) — depends_on: condition: is fully implemented in ComposeUp.swift's waitForDependencyConditions, not silently ignored:

    case ServiceDependency.serviceStarted:
        guard serviceStartStates[dependencyName] != nil else {
            throw ComposeError.dependencyNotStarted(serviceName, dependencyName)
        }
    case ServiceDependency.serviceHealthy:
        guard serviceHealth[dependencyName] == true else {
            throw ComposeError.dependencyNotHealthy(serviceName, dependencyName)
        }
    case ServiceDependency.serviceCompletedSuccessfully:
        guard serviceStartStates[dependencyName] == .completed else {
            throw ComposeError.dependencyNotCompleted(serviceName, dependencyName)
        }
    default:
        throw ComposeError.unsupportedDependencyCondition(serviceName, dependencyName, dependency.effectiveCondition)

    healthcheck: itself runs real polling via waitUntilServiceIsHealthy (container exec + configured retries/interval/start_period), and any condition this doesn't recognize throws a clear unsupportedDependencyCondition error rather than being dropped — matching the "Definition of done" from #118 (clear diagnostics instead of silent behavior differences). Looks resolved.

  2. thromel commented on Jul 2, 2026

    @thromel
    ContributorAuthor

    Closing as completed by #119. Current main implements depends_on condition handling for service_started, service_healthy, and service_completed_successfully, with healthcheck polling and explicit errors for unsupported conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions