{"record":{"id":"5f079ec8ddf67bf9","repo":"GoogleContainerTools/jib","slug":"docker-save-command-failed-with-error-getstde","errorCode":null,"errorMessage":"'docker save' command failed with error: + getStderrOutput(dockerProcess)","messagePattern":"'docker save' command failed with error: \\+ getStderrOutput\\(dockerProcess\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java","lineNumber":270,"sourceCode":"      return output;\n    }\n  }\n\n  @Override\n  public void save(\n      ImageReference imageReference, Path outputPath, Consumer<Long> writtenByteCountListener)\n      throws InterruptedException, IOException {\n    Process dockerProcess = docker(\"save\", imageReference.toString());\n\n    try (InputStream stdout = new BufferedInputStream(dockerProcess.getInputStream());\n        OutputStream fileStream = new BufferedOutputStream(Files.newOutputStream(outputPath));\n        NotifyingOutputStream notifyingFileStream =\n            new NotifyingOutputStream(fileStream, writtenByteCountListener)) {\n      ByteStreams.copy(stdout, notifyingFileStream);\n    }\n\n    if (dockerProcess.waitFor() != 0) {\n      throw new IOException(\n          \"'docker save' command failed with error: \" + getStderrOutput(dockerProcess));\n    }\n  }\n\n  @Override\n  public DockerImageDetails inspect(ImageReference imageReference)\n      throws IOException, InterruptedException {\n    Process inspectProcess =\n        docker(\"inspect\", \"-f\", \"{{json .}}\", \"--type\", \"image\", imageReference.toString());\n\n    try (InputStreamReader stdout =\n        new InputStreamReader(inspectProcess.getInputStream(), StandardCharsets.UTF_8)) {\n      String output = CharStreams.toString(stdout);\n\n      if (inspectProcess.waitFor() != 0) {\n        throw new IOException(\n            \"'docker inspect' command failed with error: \" + getStderrOutput(inspectProcess));\n      }","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java#L252-L288","documentation":"CliDockerClient.save() runs 'docker save <image>' and copies stdout into the target file with a byte-count listener. If the docker process exits nonzero after the copy, Jib throws IOException ''docker save' command failed with error: <stderr>'. This means docker could not export the requested image.","triggerScenarios":"The 'docker save' process spawned by save(imageReference, ...) returns a nonzero exit code from waitFor(), typically because the image does not exist locally or the daemon hit an error during export.","commonSituations":"Requesting save() for an image reference not present in the local docker cache (never pulled/built), mistyped tag, or daemon failure (disk full, permission error) while writing the tar stream.","solutions":["Check stderr in the message — 'No such image' means the image is not in the local docker cache","Run 'docker images' to confirm the exact image reference/tag exists locally","Pull or build the image first (docker pull / docker build), then retry save()","If it's a daemon error (disk/permission), free space or fix permissions and retry"],"exampleFix":"// before\ndockerClient.save(ImageReference.of(null, \"myapp\", null)); // image never built locally\n// after\nrunCommand(\"docker\", \"pull\", \"myapp:latest\"); // or docker build first\nDockerClient dockerClient = new CliDockerClient();\ndockerClient.save(ImageReference.of(null, \"myapp\", \"latest\"), tarPath, listener);","handlingStrategy":"validation","validationCode":"// Confirm the image exists locally before save\nProcess p = new ProcessBuilder(\"docker\", \"image\", \"inspect\", ref.toString()).start();\nif (p.waitFor() != 0) throw new IllegalStateException(\"Image not in local docker cache: \" + ref);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pull or build the image before saving","Use fully-qualified image references including the tag","Check disk space on the docker host before large exports"],"tags":["docker","docker-save","process","exit-code"],"backgroundTag":"docker-command-failed","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}