今天打算使用symfony来创作自己的新项目,但是由于网络的关系下载速度实在太慢了,于是在容器中使用以下方式使用代理,速度起飞。
export https_proxy=https://host.docker.internal:1081/
export http_proxy=http://host.docker.internal:1081/
curl -I google.com # 访问测试
# 检查是否设置好
➔ echo $http_proxy
http://localhost:1081/
➔ echo $https_proxy
https://localhost:1081/
# 取消代理
unset https_proxy
unset http_proxy
另外,在宿主机下的方式类似:
export https_proxy=https://localhost:1081/
export http_proxy=http://localhost:1081/
curl -I google.com # 访问测试