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 https://0000000000.dkr.ecr.us-east-1.amazonaws.com/v2/: dial tcp: lookup 330218730270.dkr.ecr.us-east-1.amazonaws.com on 192.168.65.1:53: read udp 192.168.65.2:60755->192.168.65.1:53: 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
(https://rubygems.org/gems/nenv-0.3.0.gem)

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.