Edit /etc/default/docker and uncomment the following line:
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
After this, restart docker and rebuild. I had the same issue today.
The solution is taken from
https://meta.discourse.org/t/afatal-unable-to-access-https-github-com-samsaffron-pups-git-could-not-resolve-host-github-com/18611/7?u=stefan