I encountered the problem how to set up proxy for docker while it’s pulling.

It seemed the way in Linux and Windows are different.

[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://username:password@proxy:port/", [EnvironmentVariableTarget]::Machine)
Restart-Service docker

in Linux, the proxy can be set @ /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://address:port/"
Environment="HTTPS_PROXY=https://address:port/"

then restart the docker

sudo systemctl restart docker