Open AlexanderBartoshZ opened 7 months ago
@bsousaa IMO it is not about network but is more about just incorrect validation of fixed-cidr
Since it is also changed in the config on restart of Docker Desktop from 192.168.10.0/24 to 192.168.10.0 might be not only GUI
This is a UI issue, the C:\User[username].docker\windows-daemon.json can be edited to fix cidr value, as a work around. The UI changes this file and this file always overwrites the %programdata%\Docker\config\daemon.json.
Please fix the configuration validation in the UI to allow the proper cidr value to be entered.
Or environment requires the fixed-cidr to be changed from the default due to subnet conflicts in our network.
Thx @guyelight. Can confirm that after changing C:\User[username].docker\windows-daemon.json and restarting twice (or switching back and force between Windows and Linux containers) the default nat network is there with the right cidr
This hits me on my company development environment. I have to use VPN and the default IP ranges are conflicting with company IPs. My only chance is to use fixed-cidr config. Can you advise a workaround? Updating windows-daemon.json and restarting didn't work.
For the ones using Hyper-V & windows containers, and it's not important to set a predefined static IP range for the containers, I think I found a workaround:
This hits me on my company development environment. I have to use VPN and the default IP ranges are conflicting with company IPs. My only chance is to use fixed-cidr config. Can you advise a workaround? Updating windows-daemon.json and restarting didn't work.
Change C:\User[username].docker\windows-daemon.json and C:\ProgramData.docker\daemon.json with the CIDR Value you want, do not use the UI.
You will then need to restart docker and sometimes it requires deleting the network. If you don't mind losing all you HSN networks you can do the following and a new NAT with the CIDR value will be created.
In a PowerShell Admin Window:
Stop-Service docker
Stop-Service hsn
Get-HostNetworks | Remove-HostNetworks docker
Start-Service hsn
Start-Service docker
Use docker network inspect nat to see if the new IP Address pool took hold.
This hits me on my company development environment. I have to use VPN and the default IP ranges are conflicting with company IPs. My only chance is to use fixed-cidr config. Can you advise a workaround? Updating windows-daemon.json and restarting didn't work.
Change C:\User[username].docker\windows-daemon.json and C:\ProgramData.docker\daemon.json with the CIDR Value you want, do not use the UI.
You will then need to restart docker and sometimes it requires deleting the network. If you don't mind losing all you HSN networks you can do the following and a new NAT with the CIDR value will be created.
In a PowerShell Admin Window:
Stop-Service docker Stop-Service hsn Get-HostNetworks | Remove-HostNetworks docker Start-Service hsn Start-Service docker
Use docker network inspect nat to see if the new IP Address pool took hold.
I didn't remove existing network. With this step, it worked. Thank you!
It worked, in terms of avoiding IP conflicts. However, name resolution is not working well from windows containers at the moment. I will go with using Hyperv external switch and a transparent docker network.
This has been an issue since version 25.0. The network scoped aliases are only support in user-defined network, See: https://github.com/nektos/act/issues/2074. Just create you own nat:
docker network create -d "nat" --subnet "10.201.0.0/24" my-nat
When you attach to the network this way the network alias can be resolved. Or just use docker compose, it creates its own network each time.
This would not be a solution in olde versions because the network would be delete on restart of windows, the latest version of Docker keep this network around after restart.
Any news on this? I'm currently testing it with the v27.2.0 and this error is still present
Description
I would like to set fixed-cidr - "192.168.10.0/24",
This is what I get when using UI:
If done manually in %programdata%\docker\config\daemon.json starting docker desktop FIXES this according to its validation rule and changes the config to "fixed-cidr": "192.168.10.0",
Clearly you get various errors depending on the fact if default nat network is present.
Please advice. We are blocked by this issue and need a solution/workaround.
Reproduce
Read the description
Expected behavior
IT WORKS :)
docker version
docker info
Diagnostics ID
2EAA9B4F-EC97-4C5F-8688-27333DF2D459/20240412150843
Additional Info
Clearly not a nice bug. Please get it fixed ASAP. Is there a workaround?