Force Docker To Only Use IPV4?

Hi! New to Docker here, I’ve installed Docker Engine on a fresh Debian install, but after running docker login, when I run the test hello world:

docker pull hello-world

I get this error:

Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:53641cd209a4fecfc68e21a99871ce8c6920b2e7502df0a20671c6fccc73a7c6": dial tcp [2600:1f18:2148:bc01:571f:e759:a87a:2961]:443: connect: cannot assign requested address

^ It looks like Docker is forcing me to use IPv6 addresses, but my home DSL connection sadly does not support IPv6 in any way (so while I can ping google.com, but not ipv6.google.com).

There’s nothing I can do about that networking limitation… but surely Docker should attempt to pull the repository via IPV4?

Is there any configuration file somewhere where I can turn off IPV6?

Couple of extra observations that might help:

  1. My Windows computer, on the same network and plugged into the same router, is able to fetch and run the hello-world container just fine. Why is Debian struggling where Windows is just fine?
  2. In my Googling I’ve noticed that the error - “cannot assign requested address” - looks like it’s one that Golang emits generically in this situation… whatever ‘this situation’ actually is.

Yesterday I tried to reproduce the issue as I see this issue from time to time and I remember once I had something similar, but don’t remember what it was exactly. I think in my case it was a problem with apt, not Docker. And it turned out that IPv6 was not properly disabled on he host. Why ping works and Docker doesn’t, I don’t know. How did you install Docker exactly?

Thanks for trying to reproduce the issue.

I did indeed install Docker via apt by following this tutorial in the Docker docs.

However, I’ve definitely disabled IPv6 on the computer, with configuration settings like:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

I don’t know why Golang’s http GET call isn’t respecting this.

I’ve seen suggestions online that it’s actually the ‘correct’ (in a procedural, standards-based sense) to print out the address in the error that the network adapter tries last, and I’ve checked the default priority of IPv6 in my mostly-default Debian install and it is indeed last. So I wonder if Docker is also trying IPv4 (and doing so first) and also failing? Doesn’t strike me as something that makes sense, but I thought it worth mentioning here.

I thought I didn’t had ipv6 at my current internet provider, but it turned out I already got one, so I disabled ipv6 in a virtual machine to test Docker. I can’t curl ipv6.google.com, but docker login works. Coul you show me a docker info output if you still have the problem?

If you can’t sovle it other way, you can add all ipv4 addresses to your /etc/hosts temporarily until you find a better solution.