So here's your problem:
Docker has assigned the range 172.17.0.1/16
to your docker0
interface. This includes all addresses from 172.17.0.1
through 172.17.255.255
. You will note that this range includes your DNS servers (172.17.100.3
and 172.17.100.70
). What you have is a routing problem:
Whenever you host needs to reach your DNS servers, it sees that it has an interface already on the same network (docker0
), so it tries to route packets using that interface...which of course go nowhere, which is why your DNS stops working.
Docker doesn't have a simple mechanism for excluding an address range from it's automatic selection process, so you'll probably need to do two things to resolve the problem:
First, explicitly set the address of docker0
in your /etc/docker/daemon.json
. Use any network that doesn't conflict your internal networks. E.g.:
{
"bip": "172.31.0.1/16"
}
You'll need to restart Docker.
Next, to prevent Docker from selecting the same network range for a user defined network (one that you create explicitly using docker network create
or implicitly using, e.g., docker-compose
or docker stack ...
), create a new network and then never use it:
docker network create --subnet 172.17.0.0/16 --config-only do_not_use
This should both resolve your problem and prevent it from cropping back up in the future.
Update
Docker actually documents an arguably better way of accomplishing this in How do I influence which network address ranges Docker chooses during a 'docker network create'?.
This requires setting persistent static routes on your system, which
varies between Linux distributions.
Best Answer
There's two ways you can get it to work
1 - Using WSL 2 based engine
In this page under "Download the Linux kernel update package".
and then Docker will start just fine
2 - Without using WSL 2 based engine
If the goal is just to get Docker running, one can simply start by unchecking the box that says "Use the WSL 2 based engine". This can give the following error
So, in PowerShell 7 run the command
which requires to Restart the computer to complete the operation. Then, once starting Docker again, you can get the following error
Eventually, just by clicking to start again, Docker will start running