5

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.

darthcrumpet
  • 343
  • 2
  • 5
  • 13

1 Answers1

4

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.

CodeMonkey
  • 4,067
  • 1
  • 31
  • 43