It was just yesterday when I helped a colleague with the same issue. In his case WSL got an IP address colliding with the Docker network, so he had to change either the network of WSL or Docker. Changing Docker network was easier, so I recommended to do that. Create or edit /etc/docker/daemon.json
and add an address pool setting:
{
"default-address-pools": [
{
"base": "192.168.0.0/16",
"size": 24
}
]
}
It could also be:
{
"default-address-pools": [
{
"base": "10.10.0.0/16",
"size": 24
}
]
}
or anything that is available in your network.
It is just an example. Make sure you don’t set a pool colliding with your local network. If you already tried to change the network of WSL, reset all the changes and reboot Windows so it can create the WSL network again.
The other, harder approach is creating a network adapter on the host which covers the IP addresses of Docker, so WSL can’t use that and it will choose an available IP address from 192.168.0.0/16
.
Update
I realized that the described configuration above was not the solution of the issue, but it happened during the configuration which was required to fix the network. At a point, Docker could not start. You can check the log file:
sudo cat /var/log/docker.log