What you can try:
a) Add a name server 8.8.8.8
Method number 1
docker-machine ssh default sudo vi /etc/resolv.conf //change nameserver to 8.8.8.8
Then restart the server using
service docker restart
Note. If you do not have a docker machine installed, you can follow the instructions here to install it. It comes with Windows and Mac, but is available for manual installation on Linux.
Method number 2
Edit /etc/docker/daemon.json or "provide the JSON configuration in the settings panel" with the following information:
{ "dns" : [ "8.8.8.8", "8.8.4.4" ]}
Then restart the server using
service docker restart
b) Configuring a proxy server
Method number 1
Change the proxy server configuration as suggested by Tarun Lalvani.
Edit /etc/default/docker and add:
export http_proxy='http://username: password@proxy-host :proxy-port' export https_proxy='https://username: password@proxy-host :proxy-port'
Then restart the server using
service docker restart
Method number 2
Source: https://github.com/moby/moby/issues/32270#issuecomment-340709035
Create a system directory for the Docker service:
mkdir -p /etc/systemd/system/docker.service.d
Then add below the content with the proxy server settings (change it to "HTTPS" for https)
[Service] Environment="HTTP_PROXY=http://<allowed_proxy_ipv4_address>:<proxy_port_num>/" [Service]
sudo systemctl daemon-reload
sudo systemctl restart docker- Verify that the configuration has been loaded:
systemctl show --property=Environment docker
c) Reinstall Docker
Unfortunately, the last resort may work. Visit these github pages for more suggestions:
For me, setting up a proxy using the systemctl method was the only thing that worked.
Katie
source share