zoukankan      html  css  js  c++  java
  • 如何配置docker使用代理?

    有两种方法可选,

    1. 修改docker的客户端配置文件~/.docker/config.json
    $ cat ~/.docker/config.json

    {
        "proxies":
        {
            "default":
            {
                "httpProxy": "http://user:password@your-proxy-server:port",
                "httpsProxy": "http://user:password@your-proxy-server:port",
                "noProxy": "*.test.example.com,.example2.com"
            }
        }
    }


    2. 运行docker时使用环境变量

    环境变量Dockerfile示例docker run示例
    HTTP_PROXY ENV HTTP_PROXY "http://user:password@your-proxy-server:port" --env HTTP_PROXY="http://user:password@your-proxy-server:port"
    HTTPS_PROXY ENV HTTPS_PROXY "http://user:password@your-proxy-server:port" --env HTTPS_PROXY="http://user:password@your-proxy-server:port"
    FTP_PROXY ENV FTP_PROXY "http://user:password@your-proxy-server:port" --env FTP_PROXY="http://user:password@your-proxy-server:port"
    NO_PROXY ENV NO_PROXY "*.test.example.com,.example2.com" --env NO_PROXY="*.test.example.com,.example2.com"

    3. 参考:

    https://docs.docker.com/network/proxy/

  • 相关阅读:
    spring框架
    自己来到这个世界的天数
    迭代器
    String
    mybatis-plus条件参数
    Linux常用命令
    web.xml
    log4j.properties
    springmvc.xml
    applicationContext.xml
  • 原文地址:https://www.cnblogs.com/dakewei/p/12834898.html
Copyright © 2011-2022 走看看