I\'m following the fig guide to using docker with a python application, but when docker gets up to the command
RUN pip install -r requirements.txt
ok, restarting my docker-machine is solving the problem. thanks – ismailsunni
This was the solution for me:
docker-machine restart <machine-name>
I had same problem.The cause of error is proxy.
So, I edit Dockerfile following
RUN pip install -r /app/requirements.txt --proxy=http://user:pass@addr:port
Im new to Docker and tried all the methods mentioned here, but still didn't get it right. the Docker version was 18, and ubuntu version was 16. I tried this method:- First i was building docker with company's internet network. this network is blocking some sites or some how things didnt go well here. So secondly i connected to my very own network(which im using in mobile phone, for example) and tried. things went right. requirement.txt was installed successfully, and docker was build.
In my case, with docker version 1.13.0
and docker-machine 0.9.0
under Ubuntu 16.04
I had to modify slightly Tanzaho's answer (2. Modifying Docker config) as follows:
Log into Ubuntu as a user with sudo privileges.
Open the /etc/default/docker file for editing:
sudo vim /etc/default/docker
Add the following setting for Docker.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
Save and close the file.
Restart the Docker daemon :
sudo service docker restart
Your problem comes from the fact that Docker is not using the proper DNS server. You can fix it in three different ways :
Modifying /etc/resolv.conf and adding the following lines at the end
# Google IPv4 nameservers
nameserver 8.8.8.8
nameserver 8.8.4.4
If you want to add other DNS servers, have a look here.
However this change won't be permanent (see this thread). To make it permanent :
$ sudo nano /etc/dhcp/dhclient.conf
Uncomment and edit the line with prepend domain-name-server :
prepend domain-name-servers 8.8.8.8, 8.8.4.4;
Restart dhclient : $ sudo dhclient
.
As explained in the docs :
Systems that run Ubuntu or an Ubuntu derivative on the desktop typically use 127.0.0.1 as the default nameserver in /etc/resolv.conf file.
To specify a DNS server for use by Docker :
1. Log into Ubuntu as a user with sudo privileges.
2. Open the /etc/default/docker file for editing :
$ sudo nano /etc/default/docker
3. Add the following setting for Docker.
DOCKER_OPTS="--dns 8.8.8.8"
4. Save and close the file.
5. Restart the Docker daemon :
$ sudo systemctl restart docker
When you run docker, simply add the following parameter : --dns 8.8.8.8
For me simply restarting docker daemon helped.
service docker restart