marcelo gallardo
marcelo gallardo

Reputation: 3

dial tcp: lookup docker on 192.168.65.7:53: no such host

I'm having trouble when logging in to docker to push my image to the container registry when using a CI script in GitLab.

Everything was working fine until I started using a self-hosted runner which I guess is what's causing the problem.
I'm using Windows and the runner is using the Docker executor.

This is the error output:

$ echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin

error during connect: Post "http://docker:2375/v1.24/auth": dial tcp: lookup docker on 192.168.65.7:53: no such host 

This is my .gitlab-ci.yml file:

stages:
   - test
   - build
run_tests:
   stage: test
   script:
       - echo "Testing"
   only:
       - merge_requests

build_image:
    stage: build
    image: docker:20.10.16
    services:
       - docker:20.10.16-dind
    variables:
       DOCKER_TLS_CERTDIR: "/certs"
    before_script:
       - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
    script:
       - docker build -t registry.gitlab.com/caronethiagoivan/ci-cd-frontend .
       - docker push registry.gitlab.com/caronethiagoivan/ci-cd-frontend
    rules:
        - if: $CI_PIPELINE_SOURCE == "merge_request_event"

Upvotes: 0

Views: 269

Answers (0)

Related Questions