V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wynemo
V2EX  ›  Docker

在国内服务器上使用 sing-box 方便的拉取 docker 镜像

  •  
  •   wynemo ·
    wynemo · 15 天前 · 1127 次点击

    在国内服务器上拉取 docker 镜像现在都出现 docker.io 连接不上的情况,可以跑个 sing-box ,开启 tun 模式,就可以拉取 docker 镜像了。

    需要注意的是如果说你的 docker 还对外提供服务 需要打开 auto_route 以及 auto_redirect 这样 tun 模式就不会与 docker 网桥冲突 不然可能会出现打开 sing-box 时 docker 对外提供的服务访问不了

    详细请看: https://github.com/wynemo/tech-notes/blob/master/science/sing-box/sing-box-for-docker-pull.md

    11 条回复    2025-05-22 13:13:53 +08:00
    coolcoffee
        1
    coolcoffee  
       15 天前   ❤️ 1
    正确的做法不应该是将 dockerd 的服务进程配置 http proxxy 环境变量吗?

    针对只能远程控制的服务器都不建议用 tun 全局,不如一个策略配置错误就只能通过 vnc 连接去重置了。
    SenLief
        2
    SenLief  
       15 天前
    不应该用 tun ,docker 是支持 http 代理的,应该配置 http 代理。
    issakchill
        3
    issakchill  
       15 天前
    开个代理 然后改 docker 的 proxy 不是更好吗
    Lentin
        4
    Lentin  
       15 天前   ❤️ 2
    不需要这么复杂
    docker pull ghcr.nju.edu.cn/sagernet/sing-box
    Lentin
        5
    Lentin  
       15 天前
    还有这个 /t/1130989
    m1nm13
        6
    m1nm13  
       15 天前
    我想问问,如何让 docker 容器也走代理, 用 shellcrash 啥的,只能代理本机,docker 容器不会被代理.
    给 docker 容器开 Privilige 权限安装 shellcrash 也不太行, 经常说缺少这个命令缺少那个命令运行的有问题

    难道只能上级路由器翻墙?
    Lentin
        7
    Lentin  
       15 天前
    @m1nm13 #6 容器内代理设置 http_proxy 和 https_proxy 的环境变量 另外还需要看看程序是否支持,不然只能上级路由分流
    totoro625
        8
    totoro625  
       15 天前
    国内服务器安装代理软件会封机器,不想被一刀切别折腾
    自己在家里软路由下面部署 nexus 代理 docker 再穿透出去给服务器用就行了
    m1nm13
        9
    m1nm13  
       15 天前
    @Lentin #7 问题就麻烦在很多程序不支持.我有点懵,不知道这玩意要怎么弄才好.
    oneisall8955
        10
    oneisall8955  
       15 天前
    南无阿弥陀佛,cf 搭建 docker proxy (类似 ghproxy )
    hwdq0012
        11
    hwdq0012  
       15 天前
    其实光开代理 是不行的,还需要加 docker registry, 我的情况是这样
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2666 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:27 · PVG 19:27 · LAX 04:27 · JFK 07:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.