一共两个部分1:
The BuildKit container — pulling images through the proxy
docker buildx create --use --name with_proxy \
--driver-opt env.HTTP_PROXY=http://172.17.0.1:7890 \
--driver-opt env.HTTPS_PROXY=http://172.17.0.1:7890
docker buildx inspect with_proxy --bootstrapThe docker buildx CLI — authorizing with docker.io, use the proxy
HTTPS_PROXY=http://172.17.0.1:7890 docker buildx --builder with_proxy build ...此外,还需要设置 --build-arg,可以参考:https://docs.docker.com/engine/cli/proxy/#configure-the-docker-client 来避免手动指定。