search

Home  >  Q&A  >  body text

docker build时怎么用http proxy代理?

dockerfile里面

RUN apt-get update && apt-get install

build的时候比较慢,想在build期间用http代理,用prioxy到127.0.0.1:8118,firefox里面代理可用,但docker build就是不行

google出来github issue里提到, docker版本1.10.3,命令试过下面的写法,都不行。

# docker build --build-arg HTTP_PROXY=http://127.0.0.1:8118 .
# docker build --build-arg=[HTTP_PROXY=http://127.0.0.1:8118] .
PHP中文网PHP中文网2835 days ago1124

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-24 09:12:22

    Each RUN line is run in a temporary container, and the proxy of the host cannot be connected using 127.0.0.1 in the container

    reply
    0
  • PHPz

    PHPz2017-04-24 09:12:22

    It is best to connect to a VPN, which acts as a global proxy and does not require any parameters.

    reply
    0
  • 怪我咯

    怪我咯2017-04-24 09:12:22

    Isn’t it possible to directly set the two environment variables http_proxy and https_proxy?

    reply
    0
  • Cancelreply