Use network=host on docker buildx build

We are already creating a custom buildx builder with options set to use
host networking. However, there are reports that this isn't sufficient
to get builds working in all situations. It is reported that adding
--network=host to the build command itself does fix things. Considering
we already intend to use host networking (per the custom buildx builder
options) lets go ahead and set --network=host on build commands as well.

This upstream issue may be related:
  https://github.com/docker/buildx/issues/1688
to the problems that have been observed, but it doesn't seem to match
completely. Maybe upstream behaviors changed since this was origianlly
reported?

Change-Id: Ie8856cf49b86e89e2bc903033e7a20874b7c9f83
This commit is contained in:
Clark Boylan
2025-09-05 07:51:09 -07:00
parent a3d0db4a7e
commit 7739ecc0e4
3 changed files with 3 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
docker_buildx_command: >-
docker buildx build {{ zj_image.path | default('.') }}
{% if containerfile %}-f {{ containerfile }}{% endif %}
--network=host
{% if zj_image.target | default(false) -%}
--target {{ zj_image.target }}
{% endif -%}

View File

@@ -8,6 +8,7 @@
set_fact:
docker_buildx_command: >-
docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
--network=host
{% if zj_image.target | default(false) -%}
--target {{ zj_image.target }}
{% endif -%}

View File

@@ -10,6 +10,7 @@
# should result in a noop build and just a push.
command: >-
docker buildx build {{ zj_image.path | default('.') }} -f {{ zj_image.dockerfile | default(docker_dockerfile) }}
--network=host
{% if zj_image.target | default(false) -%}
--target {{ zj_image.target }}
{% endif -%}