Docker build fails intermittently?

Hi, I’m running Docker Mac, and I get a lot of network-related issues when I run Docker tasks that require network access, like Docker pushes/pulls, and docker build. Like if I’m building a Ruby container, it will take forever to install all the apt packages, and then time out when installing the gems. Here is an error we got when trying to do a docker pull:

Error response from daemon: Get dial tcp: lookup on read udp> i/o timeout

But more often it will error out on one gem or another and say something like:

Gem::RemoteFetcher::UnknownHostError: no such name

When I run these docker builds in CI or on an AWS instance, they complete with no problem.

I’m running Docker for Mac 17.03.1-ce-mac5 on macOS Sierra 10.12.4.