Docker login from gitlab-ci error: dial tcp: lookup on no such host

I trying to set up a private code repository and ci/cd with Gitlab, Gitlab runner, SonarQube and Nexus. Both my containers are in same networks, m y runner already can send data to sonarqube and publish packages to nexus nuget hosted. Now, i’m trying to publish a docker image to nexus docker -hosted from my gitlab pipeline. My nexus container has a port mapped on 8083 and a docker hosted repository configured.

Heres my runner config.toml:

    concurrent = 1
    check_interval = 0
    shutdown_timeout = 0
      session_timeout = 1800
      name = "dotnet"
      url = ""
      id = 1
      token = "glrt-uoued6DwvHb7VK6n9oRb"
      token_obtained_at = 2023-06-21T22:34:27Z
      token_expires_at = 0001-01-01T00:00:00Z
      executor = "docker"
        MaxUploadedArchiveSize = 0
        tls_verify = false
        image = ""
        privileged = true
        disable_entrypoint_overwrite = false
        oom_kill_disable = false
        disable_cache = false
        volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
        shm_size = 0
        network_mode = "mynetwork"

And my gitlab-ci.yml:

    image: docker:stable
    - name: docker:dind
      command: [""]
      - docker info
      - docker login -u $NEXUS_USER -p $NEXUS_PASSWORD
      - publish
      stage: publish
        - docker build -t $IMAGE_NAME:$IMAGE_VERSION $DOCKERFILE

Error response from daemon: Get "": dial tcp: lookup on no such host

I tested inside runner container the following command: ping and it can reach it successfully.

Why only with command docker login thats happen? With commands nuget push and sonarscanner end my runner can connect with nexus nuget-hosted and sonarqube

clear a runner’s cache will solve this issue for me. but after running pipelines 4 to 5 times, I got the same error again. did you find any solution for this??