How do I stop Docker trying to pull from IPv6?
from Zagorath@aussie.zone to selfhosted@lemmy.world on 11 Aug 06:30
https://aussie.zone/post/23555109

I’m currently trying to install Docker on my old Raspberry Pi (3 Model B+) to host some personal projects. When I run docker run hello-world, I get:

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:ec153840d1e635ac434fab5e377081f17e0e15afab27beb3f726c3265039cfff": dial tcp [2600:1f18:2148:bc00:eff:d3ae:b836:fa07]:443: connect: network is unreachable

My Internet connection does not support IPv6 at all, which would explain why this error occurs. But how do I force docker-pull to only use IPv4?

#selfhosted

threaded - newest

chonkyninja@lemmy.world on 11 Aug 06:58 next collapse

It’s transparently pulling from both at the same time and the first one to connect wins. It should just work. Unless you got a typo.

frebib@social.nerdhouse.io on 11 Aug 07:41 next collapse

It will only try IPv6 if your computer has an address. Now the question is: if your network doesn’t support it, then why do you have an address?

Unforeseen@sh.itjust.works on 11 Aug 10:51 next collapse

They said thier internet connection didn’t support it, not their network.

You can lease ipv6 all day long but its not going to go anywhere if it can’t route to the internet.

Auli@lemmy.ca on 11 Aug 12:24 collapse

Well where is the router getting the prefix from if their ISP doesn’t support it.

atzanteol@sh.itjust.works on 11 Aug 12:34 next collapse

Link local adresses.

tychosmoose@piefed.social on 11 Aug 12:36 collapse

Some routers advertise a routable link local.

[deleted] on 11 Aug 12:41 collapse

.

iglou@programming.dev on 11 Aug 09:26 next collapse

Looks like your Pi thinks it can use IPv6. Find where, and disable it.

Zagorath@aussie.zone on 11 Aug 11:01 collapse

Yes, that is what I am here seeking help with.

TheKracken@lemmy.world on 11 Aug 12:38 collapse

Absolutely Disable ipv6 - Raspberry Pi Forums share.google/ynTkPxr9LkSfz5CZM

Zagorath@aussie.zone on 11 Aug 14:26 collapse

Sorry, maybe I should have explained every single step I tried in the body of the original post. I didn’t, partly because there were just too many and partly because I forgot which methods I had tried and which pages I had visited. But that page is one I’ve seen already.

It mentions to “blacklist” the module in a file that doesn’t exist. In fact, in a file that’s in a directory that doesn’t exist, which makes me very sceptical about the later claim that creating that file will fix it. /etc/modules-load.d exists, but not /etc/modules.d. I did already try the final suggestion to add that line to the end of /boot/firmware/cmdline.txt though. No luck.

I think the fact that it’s 6 years old is probably a big part of the reason it didn’t help. Files and directories have moved around. The suggestions in that post are literally just “do this” without any underlying explanation of what it’s doing that could lend to further investigation of the more modern way to do it.

tychosmoose@piefed.social on 11 Aug 12:46 next collapse

Docker is a distraction in your problem description.

It's like if you asked why the top gear in your car isn't working and gave the model of car and engine type and gearbox. But it's really that you're stuck in slow traffic. Focus on the road name and destination to find a faster route.

For your problem, search for how to disable ipv6 for the Linux distribution and version that you have installed. You will find lots of guidance. Or share those details here for someone to help.

Or, better might be to see if there is a way to get ipv6 tunneling working on your connection. It may be possible even if the ISP is unhelpful.

Zagorath@aussie.zone on 11 Aug 14:05 collapse

It’s like if you asked why the top gear in your car isn’t working and gave the model of car and engine type and gearbox

Except if I try and access the same domain using curl, it works fine. For some reason, Docker specifically is what’s failing.

tychosmoose@piefed.social on 11 Aug 15:37 collapse

Different programs have different defaults.

But in your situation which would be more helpful - prevent this one docker command from using ipv6 (likely more difficult), or preventing all commands from using your broken ipv6 config (likely easier)?

I have no idea about the first. Maybe some people know this detail. But I'm sure that with a distro and version that you're running, there are lots of people who could help with the second. Raspberry Pi 3B+ is the hardware. What software are you using?

Zagorath@aussie.zone on 11 Aug 15:48 collapse

Whatever the latest version of Raspbian was a month or two ago when I installed it. uname -a outputs […]6.12.25+rpt-rpi-v8[…]. /etc/os-release contains “Debian GNU/Linux 12 (bookworm)”.

tychosmoose@piefed.social on 11 Aug 17:25 collapse

Ok, so it's probably using NetworkManager. I would try disabling it in /etc/NetworkManager/NetworkManager.conf by adding a block like:

[ipv6]
addr-gen-mode=stable-privacy
method=disabled

Then sudo systemctl restart NetworkManager.
Can't say for sure if this will work. I dislike using NetworkManager on my servers so I can't test if this works. But hopefully the before/after of ip addr is different.

Although it looks like your ip addr output posted an hour or so ago doesn't show any ipv6 addressing. Maybe the problem is solved now.

MangoPenguin@lemmy.blahaj.zone on 11 Aug 14:08 collapse

Even if it has an IPv6 address that can’t route, it’s odd that the OS isn’t falling back to IPv4.

But disabling IPv6 in the OS should fix it, as this is not a docker problem.

Zagorath@aussie.zone on 11 Aug 14:28 collapse

But disabling IPv6 in the OS should fix it

I’ve already followed the instructions I could find to do that, but it didn’t work. Either disabling IPv6 isn’t the solution, or the instructions for how to disable it are incomplete. (You can see comments elsewhere in the thread for more detail.)

mlfh@lemmy.sdf.org on 11 Aug 14:49 collapse

Can you give us the full output of the following commands?

ip addr

sysctl net.ipv6.conf.all.disable_ipv6

Zagorath@aussie.zone on 11 Aug 15:33 collapse

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:93:9b:06 brd ff:ff:ff:ff:ff:ff
    inet 192.168.20.40/24 brd 192.168.20.255 scope global dynamic noprefixroute eth0
       valid_lft 81876sec preferred_lft 81876sec
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:c6:ce:53 brd ff:ff:ff:ff:ff:ff
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether ce:3e:0d:9b:fa:14 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
net.ipv6.conf.all.disable_ipv6 = 1