From 08b6c7cbeba7c3d45ff627daa831d25eb5b26bcc Mon Sep 17 00:00:00 2001 From: Chever John Date: Wed, 17 Jun 2026 10:28:16 +0800 Subject: [PATCH] fix(ci): use host networking and custom DNS for DinD builds DinD containers can't reach external services due to DNS/networking issues. Fix by: - Passing --dns 10.43.0.10 (CoreDNS) and --dns 223.5.5.5 (Alibaba) to DinD daemon - Using --network host for docker build to use pod networking Co-Authored-By: Claude --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 222b02a..939e9e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,8 @@ variables: .build-template: &build-template image: docker:27 services: - - docker:27-dind + - name: docker:27-dind + command: ["--dns", "10.43.0.10", "--dns", "223.5.5.5"] retry: 2 before_script: - until docker info >/dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 2; done @@ -26,7 +27,7 @@ variables: else TAG="main-${CI_COMMIT_SHORT_SHA}" fi - - docker build -t $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$TAG -f $DOCKERFILE_PATH . + - docker build --network host -t $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$TAG -f $DOCKERFILE_PATH . - docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$TAG rules: - if: $CI_COMMIT_BRANCH == "main"