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_server]
session_timeout = 1800
[[runners]]
name = "dotnet"
url = "http://gitlab.mynetwork.com"
id = 1
token = "glrt-uoued6DwvHb7VK6n9oRb"
token_obtained_at = 2023-06-21T22:34:27Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.docker]
tls_verify = false
image = "mcr.microsoft.com/dotnet/sdk"
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
services:
- name: docker:dind
command: ["--insecure-registry=nexus.mynetwork.com:8083"]
before_script:
- docker info
- docker login -u $NEXUS_USER -p $NEXUS_PASSWORD nexus.mynetwork.com:8083
stages:
- publish
publish:
stage: publish
script:
- docker build -t $IMAGE_NAME:$IMAGE_VERSION $DOCKERFILE
- docker tag $IMAGE_NAME:$IMAGE_VERSION $NEXUS_URL/$NEXUS_REPOSITORY/$IMAGE_NAME:$IMAGE_VERSION
- docker push nexus.mynetwork.com:8083/$NEXUS_REPOSITORY/$IMAGE_NAME:$IMAGE_VERSION
Error response from daemon: Get "https://nexus.mynetwork.com:8083/v2/": dial tcp: lookup nexus.mynetwork.com on 127.0.0.53:53: no such host
I tested inside runner container the following command: ping nexus.mynetwork.com
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