{"record":{"id":"d295e9954fc114ca","repo":"GoogleContainerTools/jib","slug":"docker-info-command-failed-with-error-getstde","errorCode":null,"errorMessage":"'docker info' command failed with error: + getStderrOutput(infoProcess)","messagePattern":"'docker info' command failed with error: \\+ getStderrOutput\\(infoProcess\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java","lineNumber":307,"sourceCode":"\n      return JsonTemplateMapper.readJson(output, DockerImageDetails.class);\n    }\n  }\n\n  /** Runs a {@code docker} command. */\n  private Process docker(String... subCommand) throws IOException {\n    return processBuilderFactory.apply(Arrays.asList(subCommand)).start();\n  }\n\n  private DockerInfoDetails fetchInfoDetails() throws IOException, InterruptedException {\n    Process infoProcess = docker(\"info\", \"-f\", \"{{json .}}\");\n\n    try (InputStreamReader stdout =\n        new InputStreamReader(infoProcess.getInputStream(), StandardCharsets.UTF_8)) {\n      String output = CharStreams.toString(stdout);\n\n      if (infoProcess.waitFor() != 0) {\n        throw new IOException(\n            \"'docker info' command failed with error: \" + getStderrOutput(infoProcess));\n      }\n\n      return JsonTemplateMapper.readJson(output, DockerInfoDetails.class);\n    }\n  }\n}\n","sourceCodeStart":289,"sourceCodeEnd":315,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java#L289-L315","documentation":"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().","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Run 'docker info' yourself to see the underlying error","Start the Docker daemon (Docker Desktop / systemctl start docker)","Fix DOCKER_HOST or add your user to the docker group if you get permission/连接 errors","Verify the docker CLI is installed and on PATH at the expected version"],"exampleFix":"// before\nDockerInfoDetails d = dockerClient.info(); // fails because daemon is down\n// after\nif (runCommand(\"docker\", \"info\").exitCode() != 0) {\n  throw new IllegalStateException(\"Start Docker before running this build\");\n}\nDockerInfoDetails d = dockerClient.info();","handlingStrategy":"try-catch","validationCode":"// Ensure docker daemon reachable before calling info()\nif (new ProcessBuilder(\"docker\", \"version\").start().waitFor() != 0)\n  throw new IllegalStateException(\"Docker daemon not reachable\");","typeGuard":null,"tryCatchPattern":"try {\n  details = dockerClient.info();\n} catch (IOException e) {\n  // stderr from 'docker info' is embedded in the message\n  if (e.getMessage().contains(\"permission denied\")) fixDockerGroupPermissions();\n  if (e.getMessage().contains(\"Cannot connect\")) startDockerDaemon();\n  throw e;\n}","preventionTips":["Start Docker Desktop / docker service before builds","Add the build user to the docker group to avoid socket permission errors","Verify DOCKER_HOST points at a reachable daemon"],"tags":["docker","docker-info","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"}