79811167

Date: 2025-11-06 10:49:26
Score: 1.5
Natty:
Report link

This solution worked 100% for me.

1.How to make docker use the proxy to get the base image?
Just add HTTPS or HTTP proxy into environment into your command line

export HTTP_PROXY="socks5://proxyhost:1080"
export HTTPS_PROXY="socks5://proxyhost:1080"
sudo docker build  
sudo docker pull

2.How to make docker use the proxy for the RUN and ADD instruction?

While @JSamir provided an answer, it seemed complex. Here is the solution explained in simple words:

You need to add --build-arg https_proxy=socks5://yourproxy:1080 --build-arg http_proxy=socks5://yourproxy:1080.

Important Note: Do not use single or double quotes (' or ") around the proxy address, as they prevented the proxy declaration from working in my case.

sudo docker build --build-arg https_proxy=socks5://yourproxy:1080  --build-arg http_proxy=socks5://yourproxy:1080 -t mycontainer:latest .
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @provided
  • Low reputation (1):
Posted by: CyberCr0w