GoogleContainerTools/jib · error · IOException
'docker load' command failed with error: + getStderrOutput(d
Error message
'docker load' command failed with error: + getStderrOutput(dockerProcess)
What it means
CliDockerClient.load() writes the tarball to 'docker load' stdin, then reads stdout and waits for the process. If 'docker load' exits with a nonzero exit code, Jib throws IOException ''docker load' command failed with error: <stderr>'. This is docker itself rejecting the load, reported via its stderr output.
Source
Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java:248
// message from the tarball I/O write failure when reading from stderr fails.
String error;
try (InputStreamReader stderr =
new InputStreamReader(dockerProcess.getErrorStream(), StandardCharsets.UTF_8)) {
error = CharStreams.toString(stderr);
} catch (IOException ignored) {
// This ignores exceptions from reading stderr and uses the original exception from
// writing to stdin.
error = ex.getMessage();
}
throw new IOException("'docker load' command failed with error: " + error, ex);
}
try (InputStreamReader stdout =
new InputStreamReader(dockerProcess.getInputStream(), StandardCharsets.UTF_8)) {
String output = CharStreams.toString(stdout);
if (dockerProcess.waitFor() != 0) {
throw new IOException(
"'docker load' command failed with error: " + getStderrOutput(dockerProcess));
}
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);View on GitHub (pinned to fb949e2676)
Solutions
- Read the stderr text in the message — it contains docker's actual error
- Test 'docker load -i your.tar' manually to confirm and see full output
- Re-export the image tarball (docker save / jib build output) and verify it is not truncated
- Ensure the docker daemon has sufficient disk space and supports the archive format
Example fix
// before dockerClient.load(badTarball); // nonzero exit // after Path tar = exportImageTarball(); // regenerate a valid 'docker save'-format tar assert Files.size(tar) > 0; dockerClient.load(tar);
Defensive patterns
Strategy: try-catch
Validate before calling
// Sanity-check the archive before load
try (var zf = new java.util.zip.ZipFile(tarPath.toFile())) { /* will throw if not a tar/zip */ }
// better: check manifest.json present via tar listing Try / catch
try {
dockerClient.load(tarPath);
} catch (IOException e) {
String dockerError = e.getMessage(); // contains docker's stderr
throw new ImageLoadFailedException("docker rejected archive: " + dockerError, e);
} Prevention
- Only load tarballs produced by docker save or jib's tar builder
- Verify tarball integrity (checksum) after transfer
- Ensure daemon disk space is sufficient for the image
When it happens
Trigger: The 'docker load' process spawned by load() terminates with waitFor() != 0 — invalid/corrupt tar archive format, daemon errors, or unsupported archive contents.
Common situations: Feeding a non-docker tarball (e.g. an OCI layout or a truncated file) into load(), disk-full during image extraction, or daemon version incompatibilities with the image format.
Related errors
- 'docker load' command failed with error: + error
- 'docker save' 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>
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/cb41aff8e8cc7d99.
Report an issue: GitHub.