4

Here's the situation. I'm using Docker with continuumio/anaconda3 image. I have the server (Ubuntu 16.04 LTS) configured to use the corporate proxy with CNTLM package. Internet works just fine in the host through the local proxy.

I have also modified cntlm.conf to listen to Docker's virtual network interface (docker0) at 172.17.0.1.

Docker is also properly configured and I can pull images with no problems. Once I deploy a container with an Anaconda image and I configure the container to use the host proxy by exporting the env variables http_proxy="http://172.17.0.1:3128" and so on, I can use wget and curl to download.

Problem comes with conda. I have follow the documentation and I have exported also HTTP_PROXY and HTTPS_PROXY variables. This does not work. Then I have created a .condarc file in /root directory with:

proxy_servers:
  https: localhost:3128
  http: localhost:3128

Also tried ssl_verify: False.

Nothing seems to work. I always get the following error:

CondaHTTPError: HTTP None None for url <https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2>
Elapsed: None

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/linux-64/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd88e1d1240>: Failed to establish a new connection: [Errno 111] Connection refused',)))",),)
Iyán
  • 41
  • 1
  • 2

1 Answers1

2

Try to create on Dockerfile these vars:

ENV http_proxy="x.x.x.x:xxxx"
ENV https_proxy="x.x.x.x:xxxx"

That x.x.x.x is not 127.0.0.1. That ip should be the standard LAN ip of cntlm proxy.

  • 1
    Already tried that. :S And what do you mean by *the standard LAN ip of cntlm proxy*? CNTLM creates a local proxy in the host. When I use it in the host I use 127.0.0.1 but inside Docker containers I use 172.17.0.1 becuase is the IP for the network interface `Docker0`. – Iyán Apr 04 '17 at 07:10
  • Try it! using 172.17.0.1 then. If you don't have Dockerfile and only using docker run command, make a simple Dockerfile only with the FROM and your image and the proxy ENV vars and that's all. –  Apr 04 '17 at 07:46
  • 1
    I said that I have already tried that. My docker file was like this: FROM continuumio/anaconda3 ENV http_proxy="172.17.0.1:3128" ENV https_proxy="172.17.0.1:3128" But results are equivalent to use --env flag with `docker run` or to configure proxy manually inside the live container. – Iyán Apr 04 '17 at 08:08
  • 1
    Is your cntlm proxy (ubuntu) another container? in that case don't forget to expose port 3128. If no, what is the ip of the ubuntu? that's the ip you should use at env vars. Anyway, that env vars are to use proxy inside the container and if you said you can do wget and curl successfully inside the container there is no more config... maybe your question is not a docker question, is more specific for conda which I don't know, sorry. –  Apr 04 '17 at 08:14
  • No, cntlm is configured in the host. I have `Listen 3128` and `Listen 172.17.0.1:3128` in the cntlm.conf and as you say if wget and curl works... perhaps is a conda problem or even a bug. Thanks anyway ;) – Iyán Apr 04 '17 at 10:24