{"record":{"id":"b57ccba80260f344","repo":"hyperledger/fabric","slug":"error-uploading-files-to-the-container-instance-s","errorCode":null,"errorMessage":"Error uploading files to the container instance %s: %s","messagePattern":"Error uploading files to the container instance (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container/dockercontroller/dockercontroller.go","lineNumber":305,"sourceCode":"\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error writing files to upload to Docker instance into a temporary tar blob: %s\", err)\n\t\t}\n\n\t\t// Write the tar file out\n\t\tif err = tw.Close(); err != nil {\n\t\t\treturn fmt.Errorf(\"error writing files to upload to Docker instance into a temporary tar blob: %s\", err)\n\t\t}\n\n\t\tgw.Close()\n\n\t\t_, err = vm.Client.CopyToContainer(context.Background(), containerName, dcli.CopyToContainerOptions{\n\t\t\tDestinationPath:           \"/\",\n\t\t\tContent:                   bytes.NewReader(payload.Bytes()),\n\t\t\tAllowOverwriteDirWithFile: true,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error uploading files to the container instance %s: %s\", containerName, err)\n\t\t}\n\t}\n\n\t// start container with HostConfig was deprecated since v1.10 and removed in v1.2\n\t_, err = vm.Client.ContainerStart(context.Background(), containerName, dcli.ContainerStartOptions{})\n\tif err != nil {\n\t\tdockerLogger.Errorf(\"start-could not start container: %s\", err)\n\t\treturn err\n\t}\n\n\tdockerLogger.Debugf(\"Started container %s\", containerName)\n\treturn nil\n}\n\nfunc addFiles(tw *tar.Writer, contents map[string][]byte) error {\n\tfor name, payload := range contents {\n\t\terr := tw.WriteHeader(&tar.Header{\n\t\t\tName: name,","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/container/dockercontroller/dockercontroller.go#L287-L323","documentation":"After building the gzip'd tar of TLS files, DockerVM.Start uploads it into the running-yet-stopped chaincode container using the Docker API CopyToContainer (docker cp equivalent). This error wraps any failure returned by that API call, identified by container name. It means the Docker daemon refused or failed the archive upload into the container filesystem.","triggerScenarios":"vm.Client.CopyToContainer(ctx, containerName, {DestinationPath: \"/\", Content: tarGzBytes, AllowOverwriteDirWithFile: true}) returns an error during Start when TLSConfig is set.","commonSituations":"Container was removed or is in a bad state (created/Exited) at upload time; Docker daemon down or unreachable; permission denied on the daemon socket; disk full on the Docker host; destination path '/' missing in a broken image.","solutions":["Check Docker daemon health: run 'docker ps' on the peer host and confirm the daemon socket (/var/run/docker.sock) is accessible to the peer process.","Verify the chaincode container exists with 'docker ps -a' - if it was removed, rebuild/restart it via chaincode lifecycle.","Free disk space on the Docker host if the daemon reports no space left on device.","Check the peer's docker settings in core.yaml (vm.endpoint) point to a reachable daemon.","Retry the chaincode invoke/install; transient daemon errors often clear."],"exampleFix":"// before (peer core.yaml)\nvm:\n  endpoint: unix:///var/run/docker.sock\n// after - ensure daemon is running and socket path correct\n// systemctl start docker\n// vm:\n//   endpoint: unix:///var/run/docker.sock","handlingStrategy":"retry","validationCode":"// pre-check daemon reachability before chaincode ops\n// docker -H <vm.endpoint> ps >/dev/null 2>&1 || echo \"docker daemon unreachable\"","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"Error uploading files to the container instance\") {\n    // check 'docker ps -a' for container, daemon socket perms, disk space, then retry once\n    logger.Errorf(\"docker copy-to-container failed: %v\", err)\n}","preventionTips":["Monitor Docker daemon health and disk space on peer hosts.","Grant the peer process access to /var/run/docker.sock (docker group) when using the local socket.","Ensure vm.endpoint in core.yaml points to a live daemon.","Avoid manually removing chaincode containers while the peer is running."],"tags":["docker","tls","container","copy-to-container"],"backgroundTag":"docker-copy-to-container-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"}