GoogleContainerTools/jib · error · IOException

'docker info' command failed with error: + getStderrOutput(i

Error message

'docker info' command failed with error: + getStderrOutput(infoProcess)

What it means

fetchInfoDetails() is the background task behind CliDockerClient.info(); it runs 'docker info' and parses its JSON stdout. If the process exits nonzero, Jib throws IOException ''docker info' command failed with error: <stderr>'. This surfaces the docker CLI/daemon's own error output to the caller of info().

Source

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

      return JsonTemplateMapper.readJson(output, DockerImageDetails.class);
    }
  }

  /** Runs a {@code docker} command. */
  private Process docker(String... subCommand) throws IOException {
    return processBuilderFactory.apply(Arrays.asList(subCommand)).start();
  }

  private DockerInfoDetails fetchInfoDetails() throws IOException, InterruptedException {
    Process infoProcess = docker("info", "-f", "{{json .}}");

    try (InputStreamReader stdout =
        new InputStreamReader(infoProcess.getInputStream(), StandardCharsets.UTF_8)) {
      String output = CharStreams.toString(stdout);

      if (infoProcess.waitFor() != 0) {
        throw new IOException(
            "'docker info' command failed with error: " + getStderrOutput(infoProcess));
      }

      return JsonTemplateMapper.readJson(output, DockerInfoDetails.class);
    }
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Run 'docker info' yourself to see the underlying error
  2. Start the Docker daemon (Docker Desktop / systemctl start docker)
  3. Fix DOCKER_HOST or add your user to the docker group if you get permission/连接 errors
  4. Verify the docker CLI is installed and on PATH at the expected version

Example fix

// before
DockerInfoDetails d = dockerClient.info(); // fails because daemon is down
// after
if (runCommand("docker", "info").exitCode() != 0) {
  throw new IllegalStateException("Start Docker before running this build");
}
DockerInfoDetails d = dockerClient.info();
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure docker daemon reachable before calling info()
if (new ProcessBuilder("docker", "version").start().waitFor() != 0)
  throw new IllegalStateException("Docker daemon not reachable");

Try / catch

try {
  details = dockerClient.info();
} catch (IOException e) {
  // stderr from 'docker info' is embedded in the message
  if (e.getMessage().contains("permission denied")) fixDockerGroupPermissions();
  if (e.getMessage().contains("Cannot connect")) startDockerDaemon();
  throw e;
}

Prevention

When it happens

Trigger: The 'docker info' process spawned by fetchInfoDetails() exits nonzero — daemon not running/unreachable, docker CLI missing or failing, or the info command otherwise erroring. The exception surfaces wrapped as ExecutionException inside info(), which then rethrows it as 'Failed to read output of 'docker info'.

Common situations: Docker Desktop not started, DOCKER_HOST pointing at an unreachable daemon, user not in the docker group (permission denied on /var/run/docker.sock), or a broken docker installation.

Related errors


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