Docker Build, DNS and CNTLM (Corporate Proxy)
docker build -t friendlyhello .
Got errors while trying to install Flask with pip, like in this Dockerfile line:
RUN pip install -r requirements.txt
Figured out it should be corporate proxy.
Tried every variation of http_proxy=http://localhost:3128 . No luck.
A few hours into the problem, found this thread. It nailed the problem: cannot use "localhost" becase the docker image will also have it's own "localhost".
Replaced "localhost" by my desktop's IP and voilà: pip install worked perfectly.
ENV http_proxy http://XX.XX.XX.XX:3128
ENV https_proxy http://XX.XX.XX.XX:3128
Likewise, if the Dockerfile has to resolve a DNS entry, remember to add your DNS server to docker deamon, otherwise the default DNS entry 8.8.8.8 will be set and the docker build will not recognize DNS entries that only exist in your network.
thank you for sharing this useful information
ReplyDelete