v2ray 加速docker拉取镜像

作者: 777930641f9e | 来源:发表于2020-03-08 14:10 被阅读0次

1. 下载v2ray软件包

wget https://github.com/v2ray/v2ray-core/releases/download/v4.22.1/v2ray-linux-64.zip

2. 解压缩软件包

 unzip v2ray-linux-64.zip 

3. 写入客户端配置

具体参数根据你的服务器设定来

cat  config.json
{
  "policy" : {
    "levels" : {
      "0" : {
        "uplinkOnly" : 0
      }
    }
  },
  "dns" : {
    "servers" : [
      "localhost"
    ]
  },
  "outboundDetour" : [
    {
      "protocol" : "freedom",
      "tag" : "direct",
      "settings" : {

      }
    }
  ],
  "inbound" : {
    "listen" : "0.0.0.0",
    "port" : 1081,
    "protocol" : "socks",
    "settings" : {
      "auth" : "noauth",
      "udp" : false,
      "ip" : "127.0.0.1"
    }
  },
  "inboundDetour" : [
    {
      "listen" : "0.0.0.0",
      "allocate" : {
        "strategy" : "always",
        "refresh" : 5,
        "concurrency" : 3
      },
      "port" : 8001,
      "protocol" : "http",
      "tag" : "httpDetour",
      "domainOverride" : [
        "http",
        "tls"
      ],
      "streamSettings" : {

      },
      "settings" : {
        "timeout" : 0
      }
    }
  ],
  "routing" : {
    "strategy" : "rules",
    "settings" : {
      "domainStrategy" : "IPIfNonMatch",
      "rules" : [
        {
          "domain" : [
            "localhost"
          ],
          "type" : "field",
          "outboundTag" : "direct"
        },
        {
          "type" : "field",
          "outboundTag" : "direct",
          "ip" : [
            "geoip:private"
          ]
        }
      ]
    }
  },
  "outbound" : {
    "sendThrough" : "0.0.0.0",
    "mux" : {
      "enabled" : false,
      "concurrency" : 8
    },
    "protocol" : "vmess",
    "settings" : {
      "vnext" : [
        {
          "address" : "47.75.99.255",
          "port" : 49284,
          "users" : [
            {
              "id" : "aa435739-8888-1111-7777-71a8010cff50",
              "alterId" : 733,
              "security" : "auto",
              "level" : 0
            }
          ],
          "remark" : "rongge"
        }
      ]
    },
    "streamSettings" : {
      "wsSettings" : {
        "path" : "",
        "headers" : {
          "Host" : "youraddress.com"
        }
      },
      "tlsSettings" : {
        "serverName" : "youraddress.com",
        "allowInsecure" : false
      },
      "httpSettings" : {
        "path" : "",
        "host" : [
          ""
        ]
      },
      "tcpSettings" : {
        "header" : {
          "type" : "none"
        }
      },
      "kcpSettings" : {
        "header" : {
          "type" : "none"
        },
        "mtu" : 1350,
        "congestion" : false,
        "tti" : 20,
        "uplinkCapacity" : 5,
        "writeBufferSize" : 1,
        "readBufferSize" : 1,
        "downlinkCapacity" : 20
      },
      "network" : "tcp",
      "security" : "none"
    }
  }
}

4. 启动v2ray到后台运行

./v2ray --config=config.json &

临时设置全局HTTP和HTTPS代理,该配置对docker加速镜像拉取无效,仅能用于网页访问加速,此处v2ray客户端和代理在同一台服务器,故使用127.0.0.1地址,局域网内其他服务器需要使用该代理,地址需修改为代理所在服务器内网IP,并检查iptables和安全组设置

export https_proxy=https://127.0.0.1:8001
export http_proxy=http://127.0.0.1:8001

5. 创建文件

mkdir /etc/systemd/system/docker.service.d

6. 修改文件

vim  /etc/systemd/system/docker.service.d/http-proxy.conf

加入如下配置,设置docker使用HTTP代理,局域网内其服务器需要将127.0.0.1改为代理服务器IP

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8001"

7. 重启服务

systemctl daemon-reload
systemctl restart docker

8. 查看docker信息,是否包含HTTP代理信息

docker info

9. 拉取docker镜像测试加速效果

docker pull gcr.io/google-containers/hpa-example:lastest

相关文章

  • Docker 镜像加速

    Docker 镜像加速 国内从 DockerHub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker ...

  • docker安装cloudera

    docker拉取国外的镜像速度简直难以忍受,因此配置国内的阿里云加速服务拉取镜像。 在/etc/docker目录下...

  • Centos6.6升级docker到1.9

    摘要 为了加快docker镜像的拉取和构建,采用DaoCloud等docker加速器来加快镜像的拉取。但是像Dao...

  • v2ray 加速docker拉取镜像

    1. 下载v2ray软件包 2. 解压缩软件包 3. 写入客户端配置 具体参数根据你的服务器设定来 4. 启动v2...

  • Docker 镜像制作

    Docker 镜像加速器 概述 国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Do...

  • Docker学习笔记(二)镜像加速器

    镜像加速器国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很...

  • docker虚拟机常用指令

    配置docker加速器 网址https://www.daocloud.io/mirror 搜索镜像 拉取镜像 ...

  • docker官方进行加速

    docker拉取镜像时默认从官方镜像库中拉取,有的时候速度会非常慢。阿里云提供了官方的镜像站点,从而加速官方镜像的...

  • Docker搭建apprtc服务器

    一、下载Docker 1、Docker下载地址 2、Docker加速器文档 3、拉取镜像 4、运行Server 重...

  • Docker入门(2)---Docker镜像

    Docker镜像加速 国内从 Docker Hub 拉取镜像有时会比较慢,此时可以换源,对于使用 systemd ...

网友评论

    本文标题:v2ray 加速docker拉取镜像

    本文链接:https://www.haomeiwen.com/subject/samddhtx.html