Dotnet restore fail

Problem to solve

When I try to build my ASP .NET application with Blazor with Docker on Gitlab CI, the workload restore fails:

I tried manually downloading the link and it seems like there is an issue with SSL connection:

Steps to reproduce

Just build an image from a Dockerfile with Gitlab CI (I used mcr.microsoft.com/dotnet/sdk:8.0 as a base) and run curl https://nuget.org/v3/index.json

Limiting curl to IPv4 (using the -4 switch) or TLS to v1.2 (--tlsv1.2) seems to help. Unfortunately I can’t do the same with dotnet workload restore. I tried the DOTNET_SYSTEM_NET_DISABLEIPV6 variable to restrict it to IPv4 but without success.

Configuration

This is my .gitlab-ci.yml:

image: ubuntu

stages:
- release

variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_DRIVER: overlay2
    CONTAINER_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME

release-docker-image:amd64:
  stage: release
  image: docker:29
  services:
    - docker:29-dind
  only:
    - tags
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build
      --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
      --build-arg VCS_REF=$CI_COMMIT_SHORT_SHA
      --build-arg VCS_SRC="https://gitlab.com/gaspis/gaspis/tree/$SOURCE_COMMIT"
      --build-arg VERSION=$CI_COMMIT_TAG
      -t $CONTAINER_IMAGE -f ./Dockerfile .
    - docker push $CONTAINER_IMAGE

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated
  • Self-hosted Runners

Likely SaaS Linux Small AMD64 runner cannot reach api.nuget.org (NU1301) β€” egress hangs ~10min - #10 by dnsmichi

Also seeing this issue.

Did you try the workaround configuration with the MTU setting in the linked post above?

Yes, explicitly setting the MTU allowed me to get pass that issue :slight_smile: Thanks for all your help and detailed investigation.

The workaround also works for me. Thank you @dnsmichi :folded_hands:
When debugging this myself I used all compute credits so I had to wait for new month to try. :see_no_evil_monkey: