1

当构建一个引用未缓存的图像的 Dockerfile时,以及使用;mirror.gcr.io启用时 DOCKER_BUILDKIT=1构建失败:

$ cat Dockerfile.test
FROM debian:10

$ sudo cat /etc/docker/daemon.json
{
        "registry-mirrors": ["https://mirror.gcr.io"]
}

$ DOCKER_BUILDKIT=1 docker build -f Dockerfile.test . 
[+] Building 1.0s (4/4) FINISHED                                                                                                                                                                                
 => [internal] load .dockerignore                                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                                            0.0s
 => [internal] load build definition from Dockerfile.test                                                                                                                                                  0.0s
 => => transferring dockerfile: 42B                                                                                                                                                                        0.0s
 => ERROR [internal] load metadata for docker.io/library/debian:10                                                                                                                                         0.6s
 => ERROR [1/1] FROM docker.io/library/debian:10                                                                                                                                                           0.3s
 => => resolve docker.io/library/debian:10                                                                                                                                                                 0.3s
------
 > [internal] load metadata for docker.io/library/debian:10:
------
------
 > [1/1] FROM docker.io/library/debian:10:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: docker.io/library/debian:10 not found
4

1 回答 1

0

最新(稳定)的 docker 没有最新的 buildkit。如果在镜像上找不到镜像,Buildkit 0.7 实际上会故障转移到普通的 docker Hub。

根据Github 上 @tonistiigi 的说明:使用 docker 20.10(当前为 beta),或docker buildx与较新的 buildkit 一起使用。

于 2020-11-10T20:35:55.410 回答