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

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

  1. 对第一种方法改进。在在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

相关文章