How to use http proxy proxy when docker build?

  docker, question

In dockerfile

RUN apt-get update && apt-get install

The time of build is relatively slow. I want to use http proxy during build, and use priority to 127.0.0.1:8118. the proxy in firefox is available, but doc build is not

Google outgithub issueIt is mentioned in the book that docker version 1.10.3, the command tried the following writing method, but none of them worked.

# docker build --build-arg HTTP_PROXY=http://127.0.0.1:8118 .
 # docker build --build-arg=[HTTP_PROXY=http://127.0.0.1:8118] .

Each row of RUN runs in a temporary container, and 127.0.0.1 cannot reach the proxy of the host in the container.