GoogleContainerTools/jib · error · IOException

'docker load' command failed with error: + error

Error message

'docker load' command failed with error: + error

What it means

CliDockerClient.load() pipes an image tarball into 'docker load' via the process stdin. If writing to the process stdin throws an IOException, Jib reads whatever stderr it can and throws IOException ''docker load' command failed with error: <error>', chaining the original exception. It indicates the load operation failed at the stdin-piping stage.

Source

Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java:240

    Process dockerProcess = docker("load");

    try (NotifyingOutputStream stdin =
        new NotifyingOutputStream(dockerProcess.getOutputStream(), writtenByteCountListener)) {
      imageTarball.writeTo(stdin);

    } catch (IOException ex) {
      // Tries to read from stderr. Not using getStderrOutput(), as we want to show the error
      // 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)

View on GitHub (pinned to fb949e2676)

Solutions

  1. Check the chained cause and stderr text in the message for docker's own error
  2. Run 'docker load < image.tar' manually with the same tarball to reproduce and see docker's error
  3. Verify the docker daemon is running ('docker info') and retry
  4. Regenerate/validate the image tarball; check disk space on the host

Example fix

// before
dockerClient.load(imageTarballPath); // IOException: 'docker load' command failed...
// after
try {
  dockerClient.load(imageTarballPath);
} catch (IOException e) {
  throw new BuildStepFailedException(
      "docker load failed (daemon running? tarball valid?): " + e.getMessage(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the tarball exists and looks like a docker archive before load
if (!Files.isRegularFile(tarPath) || Files.size(tarPath) == 0)
  throw new IllegalArgumentException("Invalid image tarball: " + tarPath);

Try / catch

try {
  dockerClient.load(tarPath);
} catch (IOException e) {
  // chained cause holds the stdin-write failure; stderr in the message
  throw new ImageLoadFailedException(e.getMessage(), e.getCause());
}

Prevention

When it happens

Trigger: docker loadProcess stdin write fails — the docker process died or closed stdin early (e.g. docker CLI crashed, was killed, or rejected the input), causing the ByteStreams/stdin write inside load() to throw before the normal exit-code check.

Common situations: Docker daemon restarting mid-load, out-of-disk conditions killing the CLI, invalid or corrupted image tarball causing docker to exit abruptly, or docker CLI not installed/permission problems.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/7b4253042bf1a6c2. Report an issue: GitHub.