'error during connect: Get http://docker:2375/v1.24/containers/json: dial tcp: lookup docker on 10.0.2.3:53: server misbehaving

yesterday I ran docker in docker using the following command

$ docker run -it docker

It pulled docker and took me to sh like / #

I tried to run docker in it and it was working.

But today I did the same thing again and it started giving me an error

/ # docker container ls
error during connect: Get http://docker:2375/v1.24/containers/json: dial tcp: lookup docker on 10.0.2.3:53: server misbehaving

That docker is 20.10 and at start it is running https://github.com/docker-library/docker/blob/f6a0c427f0354dcf5870c430c72c8f1d6b4e6d5e/20.10/docker-entrypoint.sh file so no need set things from cmd.



Solution 1:[1]

I had the same error but got around it.

We've been binding our host's Docker socket to the container as described in option 2 of https://docs.gitlab.com/runner/install/docker.html#option-2-use-docker-volumes-to-start-the-runner-container (the part -v /var/run/docker.sock:/var/run/docker.sock).

What was missing was to add the mounted directory to the volumes section of the runner's config.toml:

[[runners]]
  ...
  [runners.docker]
    ...
    volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]

This appearently made the TCP connection unnecessary and the error go away.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hansdaniels