Docker build 网络代理配置

2019-06-22  本文已影响0人  酒馆_1916

执行Docker build时,有部分需要×××的需求,通过引入http_proxy 解决:

对第一种方法改进。在在Docker file 里面先写上,这种会增加镜像大小 

ENV http_proxy http://ip:port 

最后在把

ENV http_proxy ""

2、 在build 中加入参数解决:

docker build \

--build-arg http_proxy=http://10.188.61.2:8118 \

--build-arg https_proxy=https://10.188.61.2:8118 \

-f Dockerfile . -t imagename:tag

docker build \

--build-arg http_proxy=http://10.188.61.2:8118 \

--build-arg https_proxy=https://10.188.61.2:8118 \

-f Dockerfile . -t imagename

上一篇 下一篇

猜你喜欢

热点阅读