{"record":{"id":"7fbbf6f37c53972b","repo":"docker/compose","slug":"container-s-exited-d","errorCode":null,"errorMessage":"container %s exited (%d)","messagePattern":"container (.+?) exited \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/convergence.go","lineNumber":480,"sourceCode":"\t\tif !ok {\n\t\t\tlinkName = externalLink\n\t\t}\n\t\tlinks = append(links, format(externalLink, linkName))\n\t}\n\treturn links, nil\n}\n\nfunc (s *composeService) isServiceHealthy(ctx context.Context, containers Containers, fallbackRunning bool) (bool, 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, err\n\t\t}\n\t\tctr := res.Container\n\t\tname := ctr.Name[1:]\n\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","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/convergence.go#L462-L498","documentation":"Error \"container %s exited (%d)\" thrown in docker/compose.","triggerScenarios":"A container that was expected to keep running (or to exit 0) exited with the reported non-zero code while compose was waiting for it, e.g. with --abort-on-container-exit or --wait.","commonSituations":"The container's main process crashed, received a fatal signal, or exited early due to a configuration or application error. Inspect the container logs for the root cause.","solutions":["Check the exited container's logs with docker compose logs <service> to find why it stopped.","Fix the application error or configuration causing the non-zero exit, then run docker compose up again.","If the exit is expected for a one-shot task, remove it from the services started with up or adjust depends_on conditions."],"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"}