vincent15000's avatar

No access to internet after using docker

Hello,

Hmmm ... after using docker, the network configuration on my computer has changed from ipv4 to ipv6.

And now some websites are accessible and others no.

It's not the first time I get this problem and I had a few lines to type in the console to restore ipv4.

I don't find any more how to do, even if I read some documentation on different websites.

Who knows this problem and how did you resolve it ?

Thanks for your help.

V

0 likes
2 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

It sounds like Docker has modified your network configuration, possibly by creating network interfaces or changing routing tables, which can sometimes interfere with your default IPv4 settings.

Here are some steps you can try to restore your IPv4 connectivity:

1. Restart Network Manager (Linux): If you’re on Linux, restarting the network manager can often resolve these issues.

sudo systemctl restart NetworkManager

Or, on some systems:

sudo service network-manager restart

2. Disable and Remove Docker Networks: Sometimes Docker's custom networks can interfere. You can prune unused networks:

docker network prune

3. Reset Network Interfaces: You can try disabling and re-enabling your main network interface. Replace eth0 or wlan0 with your actual interface name.

sudo ip link set eth0 down
sudo ip link set eth0 up

4. Renew DHCP Lease: This will force your system to request a new IPv4 address.

sudo dhclient -r
sudo dhclient

5. Check /etc/resolv.conf: Docker sometimes overwrites DNS settings. Make sure your /etc/resolv.conf contains valid nameservers, for example:

nameserver 8.8.8.8
nameserver 1.1.1.1

6. Reboot: If all else fails, a full reboot can often reset the network stack.

7. (Optional) Remove Docker Network Interfaces: If you see interfaces like docker0 or br-xxxxxx and want to remove them:

sudo ip link delete docker0

Summary: Docker can sometimes leave behind network changes. Restarting your network manager, renewing your DHCP lease, and checking your DNS settings usually resolves the issue. If you frequently encounter this, consider updating Docker or reviewing your Docker network settings.

Let me know if you need more specific help for your OS!

1 like
vincent15000's avatar

The command to type in the console is : sudo dhclient -v.

Please or to participate in this conversation.