主要错误: ERROR: failed to solve: alpine:latest: failed to copy: httpReadSeeker: failed open: failed to do request: Get “https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/a6/a606584aa9aa875552092ec9e1d62cb98d486f51f389609914039aabd9414687/data?verify=1720425322-KY1yuLurm4PjQljFrQE1DzjU0mY%3D”: EOF

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/qimu3pwp2q8wtaauhwmyh7yx9

错误类似如下:

[+] Building 10.2s (3/3) FINISHED                                                                                                                      docker:desktop-linux
 => [internal] load build definition from Dockerfile_prod                                                                                                              0.0s
 => => transferring dockerfile: 1.10kB                                                                                                                                 0.0s
 => ERROR [internal] load metadata for docker.io/library/alpine:latest                                                                                                10.1s
 => [internal] load metadata for harbor.ops.qianxin-inc.cn/ateam/nymph_base:latest                                                                                     0.6s
------
 > [internal] load metadata for docker.io/library/alpine:latest:
------
Dockerfile_prod:11
--------------------
   9 |     
  10 |     
  11 | >>> FROM alpine:latest
  12 |     WORKDIR /usr/local/manage/
  13 |     COPY --from=builder /usr/local/manage/app .
--------------------
ERROR: failed to solve: alpine:latest: failed to copy: httpReadSeeker: failed open: failed to do request: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/a6/a606584aa9aa875552092ec9e1d62cb98d486f51f389609914039aabd9414687/data?verify=1720425322-KY1yuLurm4PjQljFrQE1DzjU0mY%3D": EOF

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/qimu3pwp2q8wtaauhwmyh7yx9
docker version


Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:18:45 2024
 OS/Arch:           darwin/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.27.1 (136059)
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0c
  Built:            Thu Feb  1 00:23:17 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info


Client:
 Version:    25.0.2
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1-desktop.4
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.3-desktop.1
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.22
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-debug
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.0.0
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.3.0
    Path:     /Users/yangchangjia/.docker/cli-plugins/docker-scout

Server:
 Containers: 3
  Running: 0
  Paused: 0
  Stopped: 3
 Images: 52
 Server Version: 25.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.6.12-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 13.65GiB
 Name: docker-desktop
 ID: fdd3afcc-9eb4-4d55-a1ba-8e90d3523fcb
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

删除无用镜像:

docker rmi $(docker images | grep none | awk '{print $3}')


Deleted: sha256:7fb5d8587e0949bc377af1f1e348e1fcf6138e2b39dae8c1cd772a956e700f5e
Deleted: sha256:afd0bde7f7e3c52a927d8db2cdd5a78a06c1288881d0c4785a0f20d40a35dea4
Deleted: sha256:4b93d75e23276c2a5c2617898e9b62cb37e1ff7d3674c3c056254a70b5ff95f2
Deleted: sha256:f16ec9529d22edf222e20e37b962d4f1d1c09c8f3686d166ba902e01a5c5199a
Deleted: sha256:b2828024eb903539a34bd7b80dbd3060180fc5314fce102ffd42c76edb29c35e
Deleted: sha256:6f34d6f42dc1a3e7b902caafd6600175d1f137219a02ac15f95a0c388ae1785d
Deleted: sha256:4a984bb15879a35d5f8482cad33edd343e32777cfeb2d9680f6be0b511276c31
Deleted: sha256:5354531089d57651d36572056570f437e4649141860629d380477d96e66cf4bd
Deleted: sha256:30f56ae30669cd854495b9b9852723048b2a19bdc87bf19b3e66220ac4e82d91
Deleted: sha256:e6e26f5dbb89ab5eab23f3939aac9b2ee8464227d70fe78d1f73d50c30db7793
Deleted: sha256:daae714e2c1f457e6558e9f7875c66b019273dd271f18f2dda028215adea6be9
Deleted: sha256:12d8cbf22db5b6023445c18d19d167363b9850ae79b269792edfd53017c56c4f
Deleted: sha256:db96204b028f420fc57e93fe69188d2a86b8ed6cd7f66e21c8517cefe960520f
Deleted: sha256:43c6617f111eba2e066b57f3fb2800a529e4981bf0603c9f3f500eaa00ebec78
Deleted: sha256:08279db0d45c3f5678fdbb33f768d204bc381943545174c15457d3a60ba43ccc
Deleted: sha256:e117d4643aca9c0fe578931900963daa283f7eb30f307f1367339edf413497c2
Deleted: sha256:c11622052cbebc2ffb5aac4ff00c9367fd1c1bb46fcec33ec5f501490b5cb0a0
Deleted: sha256:e339b099bae3029e1f58de53e51d0d653133d31912614f410acd9d0784687fd4
Untagged: harbor.ops.qianxin-inc.cn/ateam/bacis_prod@sha256:c2da29810026f27fc5aa9b48d022032bd56b864ccc890e05e0319db301d41821
Deleted: sha256:5e099035fb34c3f0f0997a75e409bf6f344505709cafabf3329be8246bcf9b61
Untagged: harbor.ops.qianxin-inc.cn/ateam/briseis_prod@sha256:9ee51da8e42074d90b7bd38df507dee45829a4da37dae8dfc597e7ade19d6fc6
Deleted: sha256:46461b739b1a30f9843ca63b90b15d372aae1bf74c3dc94d325957ad2cbcd824
Untagged: harbor.ops.qianxin-inc.cn/ateam/boeotus_prod@sha256:de3a2eef5fba0a01efdae74c67a8f6e8b2e59e0da4cbfafcba560ec87a5a9916
Deleted: sha256:14f79b69fc988d0f0b83e7fb58f427f339e29a85f405cf07808f01249f99bfcd
Deleted: sha256:57c2b7825c1c6b5ab9486b6fe4363a5588ed158715bebaa1b167fb029da4b280
Deleted: sha256:760b4410f44f4ba54504e5971d37904369790831d5b37f43a44c001d6998d8e4
Deleted: sha256:5c5035a888014aaa8c6f7c78df68b835e201247314c15250b2cf82fbbf1fc5b1

解决方法:

1、配置代理:

解决ERROR: failed to solve: alpine:latest: failed to copy: httpReadSeeker: failed open: failed to do_alpine

2、配置国内仓库:

解决ERROR: failed to solve: alpine:latest: failed to copy: httpReadSeeker: failed open: failed to do_docker_02

内容如下:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "registry-mirrors": [
    "https://6kx4zyno.mirror.aliyuncs.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}