{"record":{"id":"83d7d5b7587dba71","repo":"docker/cli","slug":"failed-to-start-containers-s","errorCode":null,"errorMessage":"failed to start containers: %s","messagePattern":"failed to start containers: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/start.go","lineNumber":213,"sourceCode":"\t\t// We're not going to attach to anything.\n\t\t// Start as many containers as we want.\n\t\treturn startContainersWithoutAttachments(ctx, dockerCli, opts.Containers)\n\t}\n}\n\nfunc startContainersWithoutAttachments(ctx context.Context, dockerCli command.Cli, containers []string) error {\n\tvar failedContainers []string\n\tfor _, ctr := range containers {\n\t\tif _, err := dockerCli.Client().ContainerStart(ctx, ctr, client.ContainerStartOptions{}); err != nil {\n\t\t\t_, _ = fmt.Fprintln(dockerCli.Err(), err)\n\t\t\tfailedContainers = append(failedContainers, ctr)\n\t\t\tcontinue\n\t\t}\n\t\t_, _ = fmt.Fprintln(dockerCli.Out(), ctr)\n\t}\n\n\tif len(failedContainers) > 0 {\n\t\treturn fmt.Errorf(\"failed to start containers: %s\", strings.Join(failedContainers, \", \"))\n\t}\n\treturn nil\n}\n","sourceCodeStart":195,"sourceCodeEnd":217,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/start.go#L195-L217","documentation":"Thrown by startContainersWithoutAttachments when one or more containers fail to start in a batch `docker start` call (no --attach). Each failed container is printed to stderr individually, then this aggregate error lists all names that failed.","triggerScenarios":"Running `docker start ctr1 ctr2 ctr3` without --attach; one or more ContainerStart API calls return an error. Common daemon-side reasons: image was removed, runtime/OCI error, resource limits, port conflict, mount failure.","commonSituations":"Batch-starting after a reboot where some containers reference removed images; port conflicts among several containers; out-of-memory; one container's volume mount source missing.","solutions":["Inspect each failed container's logs/events: docker logs <failed>, docker events --filter container=<failed>","Re-create containers whose image was removed: docker run ... or docker compose up","Resolve port/resource conflicts identified in the per-container stderr lines","Start containers one at a time to isolate the first failure"],"exampleFix":"# before\ndocker start app db cache   # one or more fail\n# after\ndocker start app; docker start db; docker start cache   # isolate failures","handlingStrategy":"try-catch","validationCode":"// Start containers individually to surface the first real cause.\nfor _, c := range containers {\n    if err := cli.ContainerStart(ctx, c, client.ContainerStartOptions{}); err != nil {\n        return fmt.Errorf(\"start %s: %w\", c, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := runStart(ctx, cli, opts); err != nil {\n    if strings.Contains(err.Error(), \"failed to start containers\") {\n        // inspect each named container's events for root cause\n    }\n}","preventionTips":["In batch scripts, start containers sequentially and fail fast on the first error to keep logs actionable"],"tags":["docker","start","batch","daemon-error"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}