docker build_error ai_generated true

求解失败:前端 dockerfile.v0:无法解析 dockerfile 前端镜像:docker/dockerfile:1:未找到

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

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

其他格式: JSON · Markdown 中文 · English
80%修复率
84%置信度
1证据数
2023-11-05首次发现

版本兼容性

版本状态引入弃用备注
Docker 23.0.5 active — — —
BuildKit 0.11.6 active — — —
Dockerfile 1.5.0 active — — —

根因分析

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

English

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

generic

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 60% 失败

    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% 失败

    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.