Docker中使用pip2遇到proxy问题的解决(Can't install pip packages inside a docker container)

遇到问题如下:

Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/python-dotenv/



解决方案亲测成功:


Adding Google DNS to your local config

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.confUncomment 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.

解决方案引用至:http://stackoverflow.com/questions/28668180/cant-install-pip-packages-inside-a-docker-container-with-ubuntu

你可能感兴趣的:(Docker)