请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

docker build 总是报错

Dockerfile:1

1 | >>> FROM golang:1.24.0
2 | WORKDIR /
3 | COPY . .

ERROR: failed to solve: golang:1.24.0: failed to resolve source metadata for docker.io/library/golang:1.24.0: failed to authorize: failed to fetch oauth token: Post “https://auth.docker.io/token”: dial tcp 108.160.163.117:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

在windows11下docker build,总是出以上问题

FROM golang:1.24.0
WORKDIR /
COPY . .
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go build -o bk
ENTRYPOINT [ “/bk”, “serve” ]

run几次docker build后又出以下问题
Dockerfile:5

3 | COPY . .
4 | RUN go env -w GOPROXY=https://goproxy.cn,direct
5 | >>> RUN go build -o bk
6 | ENTRYPOINT [ “/bk”, “serve” ]

ERROR: failed to solve: process “/bin/sh -c go build -o bk” did not complete successfully: exit code: 1

docker build 后如下显示
[+] Building 21.1s (2/2) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 180B 0.0s
=> ERROR [internal] load metadata for docker.io/library/golang:1.24.0 21.1s

[internal] load metadata for docker.io/library/golang:1.24.0:


Dockerfile:1

1 | >>> FROM golang:1.24.0
2 | WORKDIR /
3 | COPY . .

ERROR: failed to solve: golang:1.24.0: failed to resolve source metadata for docker.io/library/golang:1.24.0: failed to do request: Head “https://registry-1.docker.io/v2/library/golang/manifests/1.24.0”: dialing registry-1.docker.io:443 container via direct connection because has no HTTPS proxy: connecting to registry-1.docker.io:443: dial tcp 108.160.165.11:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

正在回答 回答被采纳积分+3

1回答

暮闲 2025-02-28 11:43:34

同学你好 看看那个构建的基础镜像拉取成功了吗

0 回复 有任何疑惑可以回复我~
  • 提问者 云九州9537598 #1
    我重新编辑了一下问题
    回复 有任何疑惑可以回复我~ 2025-02-28 15:58:34
  • 暮闲 回复 提问者 云九州9537598 #2
    同学 你方便在QQ群里找到我一下吗 我给你远程看看
    回复 有任何疑惑可以回复我~ 2025-02-28 16:15:56
  • 暮闲 回复 提问者 云九州9537598 #3
    就是基础镜像拉取失败导致的
    回复 有任何疑惑可以回复我~ 2025-02-28 21:51:19
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号