V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
zhwguest
V2EX  ›  云计算

阿里云上的 docker build 死活搞不定了

  •  
  •   zhwguest · 3 天前 · 1670 次点击

    最简单的,当前目录下有一个 Dockerfile 文件,内容如下:

    docker
    
    FROM coturn/coturn:4.6.2-debian
    

    运行docker build -t your-image-name . 进行构建,则出现如下错误信息:

    [+] Building 30.1s (2/2) FINISHED                                                                                                                                                             docker:default
     => [internal] load build definition from Dockerfile                                                                                                                                                    0.0s
     => => transferring dockerfile: 69B                                                                                                                                                                     0.0s
     => ERROR [internal] load metadata for docker.io/coturn/coturn:4.6.2-debian                                                                                                                            30.0s
    ------
     > [internal] load metadata for docker.io/coturn/coturn:4.6.2-debian:
    ------
    Dockerfile:1
    --------------------
       1 | >>> FROM coturn/coturn:4.6.2-debian
       2 |
    --------------------
    ERROR: failed to solve: DeadlineExceeded: DeadlineExceeded: DeadlineExceeded: coturn/coturn:4.6.2-debian: failed to resolve source metadata for docker.io/coturn/coturn:4.6.2-debian: failed to authorize: DeadlineExceeded: failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository%3Acoturn%2Fcoturn%3Apull&service=registry.docker.io": dial tcp 31.13.94.7:443: i/o timeout
    

    这上面的 31.13.94.7 是我自己解析的,因为 auth.docker.io 已经被污染了。用 proxychains 来 curl 上面的链接是可以成功的。

    已经按照 https://docs.docker.com/engine/daemon/proxy/#httphttps-proxy 的方式为 docker daemon 设置了 proxy 。

    15 条回复    2024-09-17 11:54:32 +08:00
    tuduweb
        1
    tuduweb  
       3 天前
    上次折腾了好久,也是这个问题。
    kirory
        2
    kirory  
       3 天前   ❤️ 1
    开一台香港服务器,docker pull, docker save 之后复制过去 docker load
    aru
        3
    aru  
       3 天前   ❤️ 1
    首先,你解析的这个 ip 是错误的,31.13.94.7 是 facebook 的地址
    其次,你的代理应该是没用上,因为 31.13.94.7 应该是可以连接的,虽然会报证书错误( facebook 的证书)

    推荐你在本机部署 sniproxy ,sniproxy 可以配置通过代理访问
    LucasChang
        4
    LucasChang  
       3 天前
    试试这个,DOCKER_BUILDKIT=0 docker build .
    LucasChang
        5
    LucasChang  
       3 天前   ❤️ 1
    上面是快速验证,可行的话就证明是 buildkit / buildx 的问题,可以通过重新创建一个 buildx 构建容器解决:
    https://stackoverflow.com/questions/73210141/running-buildkit-using-docker-buildx-behind-a-proxy
    https://github.com/docker/buildx/issues/136
    Ipsum
        6
    Ipsum  
       3 天前
    不就是被墙了吗。。。
    yinmin
        7
    yinmin  
       3 天前 via iPhone   ❤️ 1
    先 docker pull coturn/coturn:4.6.2-debian 下载镜像,然后 build
    CodeAllen
        8
    CodeAllen  
       3 天前
    我建议直接开一台境外机器,比如香港、日本、新加坡的,搞完之后把镜像压缩成 tar.gz 传回来。前段时间有个 k8s 的 demo 项目需要跑起来,国内根本不行,不是卡在 docker 就是卡在脚本上,一两天了基本都是这些问题,proxychains 有时候真不一定好使,然后我直接开了一台日本的机器,反正也是按小时计费,在搞完系统依赖的情况下,20 分钟吧,全部搞定然后跑起来了。不过日本机器我用 proxychains 中转了 ssh 连接,延迟还行,如果 ssh 直连延迟太大了,输命令都卡。
    zhwguest
        9
    zhwguest  
    OP
       3 天前
    @aru 我来尝试一下,太感谢了。
    感谢 @kiroy @yinmin 谢谢提醒,好用。
    @LucasChang 我消化一下,谢谢啦
    nulIptr
        10
    nulIptr  
       3 天前
    @CodeAllen
    同意,需求不大的话也可以嫖 github action 用。。。
    luxi78
        11
    luxi78  
       3 天前
    @CodeAllen 感觉也可以在已经透明翻的个人电脑上完成这些步骤的,但稳定性可能比不上直接境外开一台机器了,好处是省钱
    SoloKing
        12
    SoloKing  
       3 天前 via Android
    如果是用 cloudflare 的 worker 创建的 mirror ,看一下这个 fix ,我也遇到了问题,测试可用,https://github.com/ciiiii/cloudflare-docker-proxy/issues/62
    LoliconInside
        13
    LoliconInside  
       3 天前
    31.13 一看就是被墙 DNS 污染了
    sn0wdr1am
        14
    sn0wdr1am  
       2 天前
    @LucasChang 是这个情况。
    realpg
        15
    realpg  
       1 天前
    31.13 笑死... 还自己解析的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2843 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 13:44 · PVG 21:44 · LAX 06:44 · JFK 09:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.