#I had similar issue on Ubuntu 16.04 and manage to solve it by adding more nameservers
#Open config file sudo nano /etc/resolv.conf and add the following under existing nameservers
nameserver 8.8.8.8
nameserver 8.8.4.4
#run following commands to restart daemon and docker service
sudo systemctl daemon-reload
sudo systemctl restart docker
#Now try to pull image you want docker pull sonarqube