This is for Windows:
Just type following script in power shell
[Environment]::SetEnvironmentVariable(“HTTP_PROXY”, “http://1.2.3.4:3128”, [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, “http://1.2.3.4:3128”, [EnvironmentVariableTarget]::Machine)
Restart-Service -Name docker
I think you may get solution here… Enjoy with docker