This issue appears to still exist in 1.12.3-beta30.1.
We were facing this issue every time we tried to build our ruby project when resolving bundle install.
To fix it we configured virtualbox to use the host name server:
docker-machine stop VBoxManage modifyvm "VM name" --natdnshostresolver1 on docker-machine start
This seems to have solved it completely. We had some issues when several TCP connections were established between our containers simultaneously and those issues have gone as well.
Running Docker on bare Mac, I was able to get dns to work on the Docker image by copying over the /etc/resolv.conf file from the Mac to the Docker image. I did this in the Dockerfile.