Search code examples
dockerdocker-composedockerfiledocker-machine

No route to host error while Building Docker Image using Dockerfile


I am trying to run following command in my dockerfile for downloading pandas package

RUN curl -x proxy.temp.com:8080 -U myid_9076:pwd123* -L -O https://files.pythonhosted.org/packages/b4/31/bbd2c915aad67c7cb572b7c6ca8f645fcb112064ef6774436d4f65acd5a1/pandas-0.20.3-cp27-cp27m-manylinux1_x86_64.whl  

But I get following error while building docker-image using same dockerfile:

---> Running in c8ddcdcdb155
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0curl: (7) Failed to connect to proxy.temp.com port 8080: No route to host

Same command runs and downloads package on bare metal node on which docker is installed. But while building docker-image it gives above error. What is the issue, how can I download this package required for my image?

Also tried setting environment variables in my dockerfile before downloading pandas package as below,

ENV http_proxy 'http://myid_9076:pwd123*@proxy.temp.com:8080/'
ENV https_proxy 'http://myid_9076:pwd123*@proxy.temp.com:8080/'

but same error is seen in this case too.


Solution

  • It was network conflict issue, my network was conflicting with docker network. So I have set parameter "bip" in /etc/docker/daemon.json as shown below

    {
        "bip" : "12.12.0.1/24"
    }
    

    Got the answer from link Unable to access local network IP from docker container