Docker设置代理、Linux系统设置代理


使用方式

新建或修改~/.docker/config.json文件,设置可用的代理地址。

{
    
    
    "proxies": {
    
    
        "default": {
    
    
            "httpProxy": "http://192.168.0.32:1080",
            "httpsProxy": "http://192.168.0.32:1080",
            "noProxy": "localhost"
        }
    }
}

重启docker。

注:经测试,这种方式仅对后面新建的容器生效,已经存在的容器似乎并不生效。若要更改已经存在的容器,可以使用下面的更改/etc/environment的方法


附:linux中git使用代理

设置

git config --global http.https://github.com.proxy socks5://192.168.0.32:1080

取消

git config --global --unset http.https://github.com.proxy

附:linux使用全局代理

编辑/etc/environment

export http_proxy="http://192.168.0.32:1080/"
export https_proxy="http://192.168.0.32:1080/"

然后source /etc/environment

猜你喜欢

转载自blog.csdn.net/qq_40579464/article/details/132063131
今日推荐