Following instructions are from official docuementation:
sudo mkdir /etc/systemd/system/docker.service.d
Create file /etc/systemd/system/docker.service.d/http-proxy.conf
with the following content:
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:3128/"
And restart docker:
sudo systemctl daemon-reload
sudo systemctl show docker | grep -i environment # should emit configured proxy settings
sudo systemctl restart docker
In order to define proxy you would need to connect to default
vhost and configure proxy settings there:
# docker-machine ssh default
# sudo -i
# echo "export HTTP_PROXY=http://your.proxy.name:8080" >> /var/lib/boot2docker/profile
# echo "export HTTPS_PROXY=http://your.proxy.name:8080" >> /var/lib/boot2docker/profile
# /etc/init.d/docker restart
# exit
# exit
After that in your docker client you can pull any images from public docker repository:
# docker pull hello-world