Docker Build, DNS and CNTLM (Corporate Proxy)



Was practicing the Docker Get Started Manual, and had to build the image:

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. 

I have CNTLM to help Ubuntu deal with TMG.

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. 


Comments

Post a Comment

Popular posts from this blog

Ubuntu 17.10 - CIFS Mount Error Code -5

Integrating Drupal 8 Webforms Submissions and Rocket Chat

Instalação eToken Pro no Ubuntu 18.04 para acesso ao eCAC da RFB