{"record":{"id":"67906e510cb4842f","repo":"hyperledger/fabric","slug":"error-creating-container-s","errorCode":null,"errorMessage":"Error creating container: %s","messagePattern":"Error creating container: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/util/utils.go","lineNumber":102,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to wait pull %s: %s\", opts.Image, err)\n\t\t}\n\t}\n\n\t// -----------------------------------------------------------------------------------\n\t// Create an ephemeral container, armed with our Image/Cmd\n\t// -----------------------------------------------------------------------------------\n\tcontainer, err := client.ContainerCreate(context.Background(), dcli.ContainerCreateOptions{\n\t\tConfig: &dcontainer.Config{\n\t\t\tAttachStdout: true,\n\t\t\tAttachStderr: true,\n\t\t\tEnv:          opts.Env,\n\t\t\tCmd:          []string{\"/bin/sh\", \"-c\", opts.Cmd},\n\t\t\tImage:        opts.Image,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating container: %s\", err)\n\t}\n\tdefer client.ContainerRemove(context.Background(), container.ID, dcli.ContainerRemoveOptions{})\n\n\t// -----------------------------------------------------------------------------------\n\t// Upload our input stream\n\t// -----------------------------------------------------------------------------------\n\t_, err = client.CopyToContainer(context.Background(), container.ID, dcli.CopyToContainerOptions{\n\t\tDestinationPath:           \"/chaincode/input\",\n\t\tContent:                   opts.InputStream,\n\t\tAllowOverwriteDirWithFile: true,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error uploading input to container: %s\", err)\n\t}\n\n\t// -----------------------------------------------------------------------------------\n\t// Attach stdout buffer to capture possible compilation errors\n\t// -----------------------------------------------------------------------------------","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/util/utils.go#L84-L120","documentation":"DockerBuild creates an ephemeral container from the builder image with the provided Env and Cmd. This error means client.ContainerCreate failed, so no build container exists. The docker API error (e.g. image missing, invalid config) is embedded in the message.","triggerScenarios":"ContainerCreate returns an error: builder image not present locally (pull skipped because ImageInspect succeeded earlier then image was removed), invalid Env/Cmd configuration, or daemon rejecting the container config.","commonSituations":"Image garbage-collected between inspect and create; malformed chaincode.builder image reference; docker daemon under resource pressure or misconfigured storage driver.","solutions":["Confirm the builder image exists (docker images) and re-pull if removed","Check the embedded docker error for the exact create rejection reason","Validate opts.Env/opts.Cmd values are well-formed","Restart/verify the docker daemon and its storage"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := client.ImageInspect(ctx, builderImage); err != nil {\n    return fmt.Errorf(\"builder image %s missing before container create\", builderImage)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"Error creating container\") {\n    logger.Errorf(\"container create failed: %s — check image presence and daemon\", err)\n    return err\n}","preventionTips":["Prevent image GC/removal while builds are in flight (docker image prune scheduling)","Validate Env/Cmd contents before invoking DockerBuild","Monitor docker daemon health and storage driver status"],"tags":["docker","container","build"],"backgroundTag":"container-create-failed","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}