{"record":{"id":"a2b2ac1d1d6b98f3","repo":"docker/compose","slug":"container-s-is-unhealthy","errorCode":null,"errorMessage":"container %s is unhealthy","messagePattern":"container (.+?) is unhealthy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/convergence.go","lineNumber":496,"sourceCode":"\n\t\tif ctr.State.Status == container.StateExited {\n\t\t\treturn false, fmt.Errorf(\"container %s exited (%d)\", name, ctr.State.ExitCode)\n\t\t}\n\n\t\tnoHealthcheck := ctr.Config.Healthcheck == nil || (len(ctr.Config.Healthcheck.Test) > 0 && ctr.Config.Healthcheck.Test[0] == \"NONE\")\n\t\tif noHealthcheck && fallbackRunning {\n\t\t\t// Container does not define a health check, but we can fall back to \"running\" state\n\t\t\treturn ctr.State != nil && ctr.State.Status == container.StateRunning, nil\n\t\t}\n\n\t\tif ctr.State == nil || ctr.State.Health == nil {\n\t\t\treturn false, fmt.Errorf(\"container %s has no healthcheck configured\", name)\n\t\t}\n\t\tswitch ctr.State.Health.Status {\n\t\tcase container.Healthy:\n\t\t\t// Continue by checking the next container.\n\t\tcase container.Unhealthy:\n\t\t\treturn false, fmt.Errorf(\"container %s is unhealthy\", name)\n\t\tcase container.Starting:\n\t\t\treturn false, nil\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"container %s had unexpected health status %q\", name, ctr.State.Health.Status)\n\t\t}\n\t}\n\treturn true, nil\n}\n\nfunc (s *composeService) isServiceCompleted(ctx context.Context, containers Containers) (bool, int, error) {\n\tfor _, c := range containers {\n\t\tres, err := s.apiClient().ContainerInspect(ctx, c.ID, client.ContainerInspectOptions{})\n\t\tif err != nil {\n\t\t\treturn false, 0, err\n\t\t}\n\t\tif res.Container.State != nil && res.Container.State.Status == container.StateExited {\n\t\t\treturn true, res.Container.State.ExitCode, nil\n\t\t}","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/convergence.go#L478-L514","documentation":"Error \"container %s is unhealthy\" thrown in docker/compose.","triggerScenarios":"A container's healthcheck reported status 'unhealthy' while compose was waiting for it to become healthy (e.g. via depends_on: service_healthy or --wait).","commonSituations":"The healthcheck command repeatedly fails (wrong port, missing binary, failing endpoint). Check 'docker inspect' Health log output for the failing probe.","solutions":["Run docker inspect on the unhealthy container to see the failing healthcheck output.","Fix the healthcheck command/interval/retries or the underlying application issue, then restart the stack."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}