From ede1ced60b673a121741b26e9bc914a3631e8e2c Mon Sep 17 00:00:00 2001 From: Jon Leech Date: Wed, 7 Oct 2026 04:43:17 +0100 Subject: [PATCH] Add '--network=host' to docker build options to work around issues with DNS resolution in some contexts (I was having to run a VPN to succeed in building from Portugal). Another option would be systemwide Docker configuration to add public DNS servers like Google's, or add them in the Dockerfile prior to running apt-get, but this seems more general if it does not affect anyone else's builds. --- build-one.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build-one.sh b/build-one.sh index 76cb394..4062754 100755 --- a/build-one.sh +++ b/build-one.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019-2024, The Khronos Group Inc. +# Copyright 2019-2026 The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 # Pass a Dockerfile name and version (typically the year and month). @@ -25,11 +25,13 @@ REPO="khronosgroup/docker-images" fi BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') [ -n "$CI" ] && echo "::group::$DOCKERFILE @ $VERSION" + # Use '--network=host' to work around DNS resolution in some contexts docker build "$@" . -f "$DOCKERFILE.Dockerfile" \ --build-arg "VERSION=$VERSION" \ --label "org.opencontainers.image.created=$BUILD_DATE" \ -t "$REPO:$DOCKERFILE" \ -t "$REPO:$DOCKERFILE.$VERSION" \ + --network=host \ $EXTRA_DOCKER_ARGS if [ "$OP" == "push" ]; then docker push "$REPO:$DOCKERFILE" @@ -42,15 +44,18 @@ REPO="khronosgroup/docker-images" echo echo "** To refer to this image precisely, use:" echo " $REPO:$DOCKERFILE.$VERSION@$HASH" - - echo "After pushing an image, it is a good idea to clean up build cache and" - echo "unused images using commands like 'docker buildx prune'," - echo "'docker image ls -a --digests', and 'docker image rmi'" else echo echo "** Not pushing, so no SHA256 manifest available. Until you push this image, refer to it as:" echo " $REPO:$DOCKERFILE.$VERSION" fi + echo "After building an image, it is a good idea to clean up build cache" + echo "and unused images using commands like:" + echo " docker buildx prune" + echo " docker image ls -a --digests" + echo " docker image rmi" + + [ -n "$CI" ] && echo "::endgroup::" )