[WSL2] wsl2 machine is not re-entrance capable by default - network collision
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
Scenario:
1. run machine starting container with networking and then delete it
```bat
limactl create template://experimental/wsl2
limactl start wsl2
limactl shell wsl2 sudo nerdctl run -d -p 8080:80 nginx
limactl stop wsl2
limactl delete wsl2
```
2. try to use the scenario of step 1 again and get error starting container
```bat
limactl create template://experimental/wsl2
limactl start wsl2
limactl shell wsl2 sudo nerdctl run -d -p 8080:80 nginx
FATA[0006] failed to verify networking settings: failed to create default network: subnet 10.4.0.0/24 overlaps with other one on this address space
```
I have the default Ubuntu instance in WSL2, so I could check that there is actually a network leftover:
```bat
wsl -d Ubuntu ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:0e:30:ad brd ff:ff:ff:ff:ff:ff
3: nerdctl0: mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 7e:90:3b:41:32:17 brd ff:ff:ff:ff:ff:ff
```
And I have to manually delete it with command line or restart the WSL2 fully
```bat
wsl --shutdown
wsl -d Ubuntu ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:0e:3a:da brd ff:ff:ff:ff:ff:ff
```
I didn't check, but I expect the same issue if running 2 WSL2 instances side by side (this might be unsupported scenario and in this case requires only documentation). The supported scenario with machine deletion w/o restarting the subsystem might be still desired.
Contributor guide
Assessment
This issue has not been assessed yet.