Problem to solve
During AutoDevOps CI/CD pipelines, HTTPS requests fail when executed during Docker image build.
What we see:
curl https://api.nuget.org/v3/index.json
fails duringdocker build
with:
curl: (35) Recv failure: Connection reset by peer
Expected:
- Docker builds should be able to fetch dependencies or reach external services.
Additional context:
- The same
curl
command works from inside a regular Kubernetes pod on the same node. - This issue appeared recently with no changes to our CI/CD configuration.
Steps to reproduce
- Run a pipeline job that builds a Docker image and includes
curl https://api.nuget.org/v3/index.json
inside the Dockerfile. - Observe that the HTTPS request fails during the build.
What we have tried:
- Added
--network=host
to thedocker build
command. - Disabled BuildKit.
- Set
FF_NETWORK_PER_BUILD: "true"
. - Verified DNS resolution works.
- Confirmed that external requests from within other pods succeed.
Configuration
.gitlab-ci.yml snippet:
build:
stage: build
image: docker:latest
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker build --network=host -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
Versions
- GitLab: 18.0.2 (self-managed)
- GitLab Runner: 18.0.3 (executor: kubernetes)
- Kubernetes: v1.30.0
Notes
- GitLab Runner is deployed in Kubernetes using Helm.
- We suspect recent GitLab Runner or AutoDevOps behavior has changed regarding networking during build phase.