概述
记录一下Docker、Git和其他命令(如repo)的代理配置。
Docker (版本>=17.07)
设置
打开~/.docker/config.json:
1 2 3 4 5 6 7 8 9 10 11
| { "proxies": { "default": { "httpProxy": "http://localhost:8080", "httpsProxy": "http://localhost:8080", "noProxy": "localhost,127.0.0.1" } } }
|
运行docker run和docker build时增加--network=host参数
注意:apt只支持http代理
取消
删除配置即可
Git
设置
1 2 3
| export PROXY_URL=http://localhost:8080 git config --global http.proxy $PROXY_URL git config --global https.proxy $PROXY_URL
|
取消
1 2 3
| unset PROXY_URL git config --global --unset http.proxy git config --global --unset https.proxy
|
其他
repo wget curl等
设置
1 2 3
| export PROXY_URL=http://localhost:8080 export https_proxy=$PROXY_URL export http_proxy=$PROXY_URL
|
查询ip地址,检测代理是否连接成功:
取消
1 2 3
| unset PROXY_URL unset https_proxy unset http_proxy
|