Skip to content

Gitlab CI returns error - no such host error (public runners)

Description of the problem

We use GitLab CI for our project with public runners and today we have error, when i push new code and pipeline starts.

Steps to reproduce

Running with gitlab-runner 12.1.0 (de7731dd)
  on docker-auto-scale 72989761
Using Docker executor with image docker/compose:1.24.0 ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:381e1d0bc6ef1b9619690dbc0de477588c4a1f14fc781e31b0123ac6f421c25c for docker:dind ...
Waiting for services to be up and running...

*** WARNING: Service runner-72989761-project-12691518-concurrent-0-docker-0 probably didn't start properly.

Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-72989761-project-12691518-concurrent-0-docker-0 AS /runner-72989761-project-12691518-concurrent-0-docker-0-wait-for-service/service (executor_docker.go:1257:0s)

Service container logs:
2019-08-02T11:08:09.951851019Z time="2019-08-02T11:08:09.939003524Z" level=info msg="Starting up"
2019-08-02T11:08:09.951905919Z time="2019-08-02T11:08:09.939539195Z" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!]"
2019-08-02T11:08:09.951911484Z failed to load listeners: listen tcp: lookup docker on 169.254.169.254:53: no such host

*********

Pulling docker image docker/compose:1.24.0 ...
Using docker image sha256:4624ec04635e2ee766824126dc6080b06e05fe85adb54cf294e20e7b8db0d86c for docker/compose:1.24.0 ...
Running on runner-72989761-project-12691518-concurrent-0 via runner-72989761-srm-1564744020-793dc7c7...
Fetching changes...
Initialized empty Git repository in /builds/python-snakes/financex-backend/.git/
Created fresh repository.
From https://gitlab.com/python-snakes/financex-backend
 * [new branch]      add_jwt_integration -> origin/add_jwt_integration
 * [new branch]      master              -> origin/master
Checking out 14180112 as add_jwt_integration...

Skipping Git submodules setup
$ docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://docker:2375/v1.38/info: dial tcp: lookup docker on 169.254.169.254:53: no such host). Using system default: https://index.docker.io/v1/
error during connect: Post http://docker:2375/v1.38/auth: dial tcp: lookup docker on 169.254.169.254:53: no such host

Example Project

https://gitlab.com/python-snakes/financex-backend/

What is the current bug behavior?

Warning: failed to get default registry endpoint from daemon (error during connect: Get http://docker:2375/v1.38/info: dial tcp: lookup docker on 169.254.169.254:53: no such host). Using system default: https://index.docker.io/v1/
error during connect: Post http://docker:2375/v1.38/auth: dial tcp: lookup docker on 169.254.169.254:53: no such host

And pipline failed.

What is the expected correct behavior?

Pipeline passed successfully.

Output of checks

This bug happens on GitLab.com

Gitlab file.

gitlab-ci.yml

image:
  name: docker/compose:1.24.0
  entrypoint: ["/bin/sh", "-c"]

services:
  - docker:dind

variables:
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2

before_script:
  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

stages:
  - build
  - test

composer:
  stage: build
  script:
    - docker-compose pull || true
    - docker-compose build
    - docker-compose push web
    - export TAG=$CI_COMMIT_REF_SLUG
    - docker-compose build
    - docker-compose push web

check-migrations:
  stage: test
  script:
    - export TAG=$CI_COMMIT_REF_SLUG
    - docker-compose pull
    - docker-compose up -d
    - docker-compose run -T web python manage.py makemigrations --check --dry-run

lint:
  stage: test
  script:
    - export TAG=$CI_COMMIT_REF_SLUG
    - docker-compose pull
    - docker-compose run --no-deps -T web find ./ -name "*.py" ! -path "./*/migrations/*" -exec pylint --exit-zero "{}" +

isort:
  stage: test
  script:
    - export TAG=$CI_COMMIT_REF_SLUG
    - docker-compose pull
    - docker-compose run --no-deps -T web isort -rc --check-only