Assuming that you are behind a cooperate proxy and running cntlm or squid to proxy all your outgoing traffic to the interweb.
When using docker for Mac, becuase docker for mac provision a xhyve VM under the hood, so having set the docker preference proxy setting to http[s]://localhost:3128 is not going to help as localhost == xhyve VM not the Mac.
Logging into the xhyve VM
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
and run ifconfig, observe eth0 which is the network connecting to the host and it just happen that the X.X.X.1 is the host ip address.
e.g. 192.168.65.2 is the eth0 address therefore 192.168.65.1 is the host ip from the xhyve VM
Set the http and https proxy in docker preference!!!
reference: https://forums.docker.com/t/beta-13-didnt-work-with-local-proxy/13569/12