{"record":{"id":"6263752877eb529c","repo":"docker/compose","slug":"no-container-s-found-with-the-following-name-s","errorCode":null,"errorMessage":"no container(s) found with the following name(s): %s","messagePattern":"no container\\(s\\) found with the following name\\(s\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/generate.go","lineNumber":62,"sourceCode":"\n\tcontainersByIds, err := s.apiClient().ContainerList(ctx, client.ContainerListOptions{\n\t\tFilters: make(client.Filters).Add(\"id\", options.Containers...),\n\t\tAll:     true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, ctr := range containersByIds.Items {\n\t\tif !slices.ContainsFunc(containers, func(summary container.Summary) bool {\n\t\t\treturn summary.ID == ctr.ID\n\t\t}) {\n\t\t\tcontainers = append(containers, ctr)\n\t\t}\n\t}\n\n\tif len(containers) == 0 {\n\t\treturn nil, fmt.Errorf(\"no container(s) found with the following name(s): %s\", strings.Join(options.Containers, \",\"))\n\t}\n\n\treturn s.createProjectFromContainers(containers, options.ProjectName)\n}\n\nfunc (s *composeService) createProjectFromContainers(containers []container.Summary, projectName string) (*types.Project, error) {\n\tproject := &types.Project{}\n\tservices := types.Services{}\n\tnetworks := types.Networks{}\n\tvolumes := types.Volumes{}\n\tsecrets := types.Secrets{}\n\n\tif projectName != \"\" {\n\t\tproject.Name = projectName\n\t}\n\n\tfor _, c := range containers {\n\t\t// if the container is from a previous Compose application, use the existing service name","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/generate.go#L44-L80","documentation":"'docker compose generate' builds a compose project from running containers, first resolving the requested container names/IDs. If the resulting set is empty after querying by name (and by IDs), it reports the joined list of names it could not find.","triggerScenarios":"docker compose generate <container...> where no listed name/ID matches a running or stopped container visible to the current docker context; containersByIds and name lookups both return nothing.","commonSituations":"Typo in container name; container removed or not yet started; wrong docker context; using compose service names instead of actual container names (e.g. missing project prefix like myproject-web-1).","solutions":["List real names: docker ps -a --format '{{.Names}}' and retry with one of those","Use the container ID instead of the name","Verify the docker context matches where the containers run (docker context show)","Start the container first if it exists but is stopped and you need it in the project"],"exampleFix":"# before\ndocker compose generate web        # actual name is demo-web-1\n# after\ndocker compose generate demo-web-1","handlingStrategy":"validation","validationCode":"// verify names resolve before calling Generate\nres, err := cli.ContainerList(ctx, client.ContainerListOptions{All: true})\nif err != nil { return err }\nbyName := map[string]bool{}\nfor _, c := range res { byName[c.Names[0][1:]] = true; byName[c.ID[0:12]] = true }\nfor _, n := range wanted { if !byName[n] { return fmt.Errorf(\"unknown container %s\", n) } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Query docker ps for exact names before generating","Use container IDs to avoid project-prefix confusion","Confirm the docker context points at the right host"],"tags":["generate","containers","not-found"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}