Your problem comes from the fact that Docker is not using the proper DNS server. You can fix it in three different ways :
- Adding Google DNS to your local config
Modifying /etc/resolv.conf and adding the following lines at the end
Google IPv4 nameservers
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 184.108.40.206, 220.127.116.11;
Restart dhclient : $ sudo dhclient.
- Modifying Docker config
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 :
Log into Ubuntu as a user with sudo privileges.
Open the /etc/default/docker file for editing :
$ sudo nano /etc/default/docker
Add the following setting for Docker.
Save and close the file.
Restart the Docker daemon :
$ sudo systemctl restart docker
Using a parameter when you run Docker
When you run docker, simply add the following parameter : --dns 18.104.22.168