docker build_error ai_generated true

failed to solve: frontend dockerfile.v0: failed to resolve dockerfile frontend image: docker/dockerfile:1: not found

ID: docker/buildkit-frontend-image-not-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
1Evidence
2023-11-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Docker 23.0.5 active — — —
BuildKit 0.11.6 active — — —
Dockerfile 1.5.0 active — — —

Root Cause

The BuildKit frontend image specified in the Dockerfile's syntax directive is not available or the registry is unreachable.

generic

中文

Dockerfile 语法指令中指定的 BuildKit 前端镜像不可用或无法访问注册表。

Official Documentation

https://docs.docker.com/build/buildkit/#getting-started

Workarounds

  1. 85% success Explicitly set the syntax directive at the top of the Dockerfile: `# syntax=docker/dockerfile:1.5.0` and ensure the BuildKit version supports it. Then build with `DOCKER_BUILDKIT=1 docker build .`
    Explicitly set the syntax directive at the top of the Dockerfile: `# syntax=docker/dockerfile:1.5.0` and ensure the BuildKit version supports it. Then build with `DOCKER_BUILDKIT=1 docker build .`
  2. 75% success If behind a proxy, configure Docker daemon proxy settings in `/etc/systemd/system/docker.service.d/http-proxy.conf` to allow BuildKit to reach the registry.
    If behind a proxy, configure Docker daemon proxy settings in `/etc/systemd/system/docker.service.d/http-proxy.conf` to allow BuildKit to reach the registry.

中文步骤

  1. Explicitly set the syntax directive at the top of the Dockerfile: `# syntax=docker/dockerfile:1.5.0` and ensure the BuildKit version supports it. Then build with `DOCKER_BUILDKIT=1 docker build .`
  2. If behind a proxy, configure Docker daemon proxy settings in `/etc/systemd/system/docker.service.d/http-proxy.conf` to allow BuildKit to reach the registry.

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Disabling BuildKit may work but loses build optimizations and can cause other errors if the Dockerfile uses syntax features only supported by BuildKit.

  2. 70% fail

    The error is not about a missing local image; BuildKit tries to fetch the image from the registry during build, and pulling it manually may not resolve the issue if the registry is blocked.