Error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on x.x.x.x:53: no such host

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

I have a classic yml file with Gitlab shared runner and Docker and I ahave an issue that I have not succed to solve.

attaume_run:
  variables:
    DOCKER_HOST: tcp://docker:2375/
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
  stage: build
  needs: []
  image:
    name: docker/compose:latest
  services:
    - docker:dind
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD registry.gitlab.com
  script:
    - cd attaume/
    - echo "$TOKEN"
    - docker build -t $CI_REGISTRY_IMAGE .
    - docker push $CI_REGISTRY_IMAGE
  rules:
    - changes:
      - attaume/**/*

But I get this error whereas some weeks ago, it worked.

I use :

I found a lot of topics on that subject, but I didn’t find the solution.

Thanks in advance.

That error message suggests that you’re trying to use docker-in-docker (the highlighted “services” in the screenshot also suggest that) on a (docker, I haven’t tried on anything else) runner that doesn’t support it.

I have no idea what “Gitlab.com classic gitlab runners” means, we have a GitLab setup on-premise with our own runners, I have no idea if GitLab offers anything for SaaS users (I know they can set up their own).

By “Gitlab.com classic gitlab runners”, I mean shared runners.

Thanks for the answer.
I found the solution with kaniko. See the doc here: Use kaniko to build Docker images | GitLab

Need to edit → /etc/gitlab-runner/config.toml
Problem is here, need to add "/var/run/docker.sock:/var/run/docker.sock" to volumes
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]

Runner config will be

[[runners]]
  name = "max"
  url = "https://max.lv"
  id = 3
  token = "glrt-Pnz4_jx3_reTXZ1B"
  token_obtained_at = 2024-04-02T11:11:56Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:24.0.5"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    shm_size = 0
    network_mtu = 0
1 Like

this worked
thanks :slight_smile:

Made an account just to thank you, this resolved my problem too, together with using

  • unset DOCKER_HOST