{"record":{"id":"2b83a4c098106517","repo":"docker/compose","slug":"no-container-found-for-service-q","errorCode":null,"errorMessage":"no container found for service %q","messagePattern":"no container found for service %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/cp.go","lineNumber":136,"sourceCode":"\tswitch {\n\tcase options.Index > 0:\n\t\tctr, err := s.getSpecifiedContainer(ctx, projectName, oneOffExclude, true, serviceName, options.Index)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn append(containers, ctr), nil\n\tdefault:\n\t\twithOneOff := oneOffExclude\n\t\tif options.All {\n\t\t\twithOneOff = oneOffInclude\n\t\t}\n\t\tcontainers, err = s.getContainers(ctx, projectName, withOneOff, true, serviceName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(containers) < 1 {\n\t\t\treturn nil, fmt.Errorf(\"no container found for service %q\", serviceName)\n\t\t}\n\t\tif direction == fromService {\n\t\t\treturn containers[:1], err\n\t\t}\n\t\treturn containers, err\n\t}\n}\n\nfunc (s *composeService) copyToContainer(ctx context.Context, containerID string, srcPath string, dstPath string, opts api.CopyOptions) error {\n\tvar err error\n\tif srcPath != \"-\" {\n\t\t// Get an absolute source path.\n\t\tsrcPath, err = resolveLocalPath(srcPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/cp.go#L118-L154","documentation":"Error \"no container found for service %q\" thrown in docker/compose.","triggerScenarios":"'docker compose cp' could not find a running (or existing) container for the named service in the project.","commonSituations":"The service is stopped or never started, the project name differs from the one used to bring the stack up, or a container index is out of range.","solutions":["Start the service first with docker compose up -d <service> before copying files to or from it.","Verify the service name is correct with docker compose ps and that its container has not been removed."],"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"}