{"record":{"id":"fa1745fbe892635e","repo":"elastic/elasticsearch","slug":"failed-to-pull-docker-base-image-baseimage-al","errorCode":null,"errorMessage":"Failed to pull Docker base image [{baseImage}], all attempts failed","messagePattern":"Failed to pull Docker base image \\[(.+?)\\], all attempts failed","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/docker/DockerBuildTask.java","lineNumber":233,"sourceCode":"\n            for (int attempt = 1; attempt <= maxAttempts; attempt++) {\n                try {\n                    LoggedExec.exec(execOperations, spec -> {\n                        maybeConfigureDockerConfig(spec);\n                        spec.executable(docker);\n                        spec.args(\"pull\");\n                        spec.environment(\"DOCKER_BUILDKIT\", \"1\");\n                        spec.args(baseImage);\n                    });\n\n                    return;\n                } catch (Exception e) {\n                    LOGGER.warn(\"Attempt {}/{} to pull Docker base image {} failed\", attempt, maxAttempts, baseImage);\n                }\n            }\n\n            // If we successfully ran `docker pull` above, we would have returned before this point.\n            throw new GradleException(\"Failed to pull Docker base image [\" + baseImage + \"], all attempts failed\");\n        }\n\n        private void maybeConfigureDockerConfig(ExecSpec spec) {\n            String dockerConfig = System.getenv(\"DOCKER_CONFIG\");\n            if (dockerConfig != null) {\n                spec.environment(\"DOCKER_CONFIG\", dockerConfig);\n            }\n        }\n\n        @Override\n        public void execute() {\n            final Parameters parameters = getParameters();\n\n            if (parameters.getPull().get()) {\n                parameters.getBaseImages().get().forEach(this::pullBaseImage);\n            }\n\n            final List<String> tags = parameters.getTags().get();","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/docker/DockerBuildTask.java#L215-L251","documentation":"Thrown by DockerBuildTask.DockerBuildAction.pullBaseImage() after a retry loop (maxAttempts = 10) exhausts all attempts to run `docker pull <baseImage>`. Each failed attempt is logged at WARN with the attempt count; only after all 10 fail does the GradleException fire, naming the base image. The retry exists to absorb transient registry/network errors, so reaching this exception means a persistent failure.","triggerScenarios":"The Docker build task is configured with `pull = true` (or a multi-platform push requires pulling the just-built image), and `docker pull` fails 10 times in a row. Causes: the base image name/tag does not exist in the registry; authentication to the registry is missing/wrong; network/DNS failure reaching the registry; Docker daemon not running or misconfigured; rate limits from Docker Hub.","commonSituations":"Building behind a corporate proxy without DOCKER_CONFIG/credentials configured; typo in the base image tag; Docker Hub rate-limiting on anonymous pulls; the base image is in a private registry the build cannot auth to; Docker daemon is stopped.","solutions":["Check the base image name and tag exist: `docker pull <baseImage>` manually and read the actual error (the task only logs 'failed', not the cause).","Ensure registry credentials are available — set DOCKER_CONFIG to a dir with a valid config.json, or `docker login` to the registry.","Verify the Docker daemon is running (`docker info`) and the host can reach the registry (network/proxy/DNS).","If hitting Docker Hub rate limits, authenticate or use an authenticated mirror/registry.","Re-run with `--info` to see the per-attempt WARN logs and inspect whether failures are consistent or intermittent."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before the build, verify the base image is pullable:\n// run `docker pull <baseImage>` manually; ensure `docker login`/DOCKER_CONFIG is set for private registries.","typeGuard":null,"tryCatchPattern":"// The task already retries 10x. To add outer resilience, catch GradleException\n// and surface the underlying docker error by running `docker pull` manually first:\n// try { pullBaseImage(img); } catch (GradleException e) { log docker daemon status; throw e; }","preventionTips":["Pre-pull base images manually to confirm they exist and credentials work.","Configure DOCKER_CONFIG or run `docker login` for private/auth-required registries.","Use an authenticated registry mirror to avoid Docker Hub rate limits.","Ensure the Docker daemon is running (`docker info`) before starting the build."],"tags":["docker","build","network","registry","retry"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}