- https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/
- https://crondev.com/running-docker-behind-proxy/
Per https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
cat << EOF > /etc/docker/daemon.json
{
"dns": ["10.0.0.2", "8.8.8.8"]
}
EOF
sudo service docker restart
cat <<EOF | sudo tee -a /etc/default/docker
export http_proxy="http://myproxy.example.com:8080"
export https_proxy="https://myproxy.example.com:8080"
export no_proxy=<REGISTRY_IP>
EOF
# newly
mkdir -p /etc/systemd/system/docker.service.d
cat << EOF | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://www-proxy.example.com:80/"
EOF
sudo service docker restart
sudo docker build -t foo/bar \
--build-arg http_proxy="http://myproxy.example.com:8080" \
--build-arg https_proxy="https://myproxy.example.com:8080" \
.