Fixing Docker Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup i/o timeout on Mac

I was working on a project and at some point needed to run a new docker image that wasn't on my machine. When i tried to run it I got this error:
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: read udp 10.0.2.15:50343->10.0.2.3:53: i/o timeout.

I was surprised to see that, but i managed to find quick solution for this:

docker-machine ssh default
sudo vi /etc/resolv.conf

Change nameserver to 8.8.8.8 and you're good to go.

Thanks Mikhail Kaduchka for this nice tip that i have found in Github issue