GoogleContainerTools/jib · error · IOException
'docker save' command failed with error: + getStderrOutput(d
Error message
'docker save' command failed with error: + getStderrOutput(dockerProcess)
What it means
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.
Source
Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java:270
return output;
}
}
@Override
public void save(
ImageReference imageReference, Path outputPath, Consumer<Long> writtenByteCountListener)
throws InterruptedException, IOException {
Process dockerProcess = docker("save", imageReference.toString());
try (InputStream stdout = new BufferedInputStream(dockerProcess.getInputStream());
OutputStream fileStream = new BufferedOutputStream(Files.newOutputStream(outputPath));
NotifyingOutputStream notifyingFileStream =
new NotifyingOutputStream(fileStream, writtenByteCountListener)) {
ByteStreams.copy(stdout, notifyingFileStream);
}
if (dockerProcess.waitFor() != 0) {
throw new IOException(
"'docker save' command failed with error: " + getStderrOutput(dockerProcess));
}
}
@Override
public DockerImageDetails inspect(ImageReference imageReference)
throws IOException, InterruptedException {
Process inspectProcess =
docker("inspect", "-f", "{{json .}}", "--type", "image", imageReference.toString());
try (InputStreamReader stdout =
new InputStreamReader(inspectProcess.getInputStream(), StandardCharsets.UTF_8)) {
String output = CharStreams.toString(stdout);
if (inspectProcess.waitFor() != 0) {
throw new IOException(
"'docker inspect' command failed with error: " + getStderrOutput(inspectProcess));
}View on GitHub (pinned to fb949e2676)
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
Example fix
// before
dockerClient.save(ImageReference.of(null, "myapp", null)); // image never built locally
// after
runCommand("docker", "pull", "myapp:latest"); // or docker build first
DockerClient dockerClient = new CliDockerClient();
dockerClient.save(ImageReference.of(null, "myapp", "latest"), tarPath, listener); Defensive patterns
Strategy: validation
Validate before calling
// Confirm the image exists locally before save
Process p = new ProcessBuilder("docker", "image", "inspect", ref.toString()).start();
if (p.waitFor() != 0) throw new IllegalStateException("Image not in local docker cache: " + ref); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- 'docker load' command failed with error: + getStderrOutput(d
- 'docker inspect' command failed with error: + getStderrOutpu
- 'docker info' command failed with error: + getStderrOutput(i
- Failed to read output of 'docker info': <message>
- 'docker load' command failed with error: + error
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/5f079ec8ddf67bf9.
Report an issue: GitHub.