Reputation: 413
My organization uses a http/https proxy. Traffic to the internet must be routed via this proxy.
We're adding multi-architecture support to our jenkins pipelines which build and push the docker images. The HTTP_PROXY and HTTPS_PROXY environment variables are set for docker and working for a regular docker build, but when attempting to build for multiple architectures using the docker buildx build
command, I see the error below
failed to solve: rpc error: code = Unknown desc = amazoncorretto:11: failed to do request: Head "https://registry-1.docker.io/v2/library/amazoncorretto/manifests/11": dial tcp 44.207.96.114:443: i/o timeout
It works locally. I'm certain this is because the traffic isn't routed via the proxy. I've tried setting it via driver-opt and build-arg.
Upvotes: 10
Views: 5818
Reputation: 1
I also struggled with this docker buildx. I used --driver-opt with proxies, but still it did not solve.
Passing proxies to --build-arg also did not help me. (In one VM it solved the issue but in other VM it did not help)
What helped me is when I passed "/run/buildkit/buildkitd.sock" to no_proxy
something like this export no_proxy="127.0.0.1,localhost,/run/buildkit/buildkitd.sock"
/run/buildkit/buildkitd.sock is critical for buildx.
Upvotes: 0
Reputation: 4786
After not finding any answer to this on StackOverflow I scoured some other resources. You need to specify the proxy using driver opts, but you need to specify the IP of the bridge, e.g.
docker buildx create --use --driver-opt env.http_proxy=172.17.0.1:3128 --driver-opt env.https_proxy=172.17.0.1:3128 --driver-opt '"env.no_proxy='$no_proxy'"'
docker buildx build ...
You also need to configure your proxy (e.g. CNTLM) to accept connections on this IP.
Upvotes: 7