Open stephen-turner opened 3 years ago
I would love to see this issue resolved as well. I've spent countless hours trying to debug the application logic and the docker setup on my Windows Server 2022 machine only to find that the problem is in fact the above.
For those looking for a temporary workaround (and I appreciate that this won't apply to more complex setups!), simplifying the networking stack in the compose file resolved all my issues with the containers sporadically hanging during startup, having to restart the docker service and in some cases the entire system etc. Specifically, I removed the custom networks and customised the default one instead to prevent having multiple networks (default network was being created automatically). I'm only mentioning this here to aid those who also struggled with the same problem in a hope it gets more visibility online.
Hey @marceliwac, Would you be able to provide an example of the workaround that you created? What I'm currently doing is that in my compose file, I'm using the nat network as an external network so that it attaches it to the default nat network created by Windows Containers. The problem with that though is that when you restart your machine, internally it seems Windows decides to recreate the default nat network each time so it's internal ID changes. Because of that, any compose files (and thus their already deployed containers) pointing to the older ID prior to the restart, fail to start. So I currently had to create and run a script on each startup that basically brings down all of my compose configs, then recreates them (to get the new network IDs on each boot).
@sikhness I'm afraid the workaround I use wouldn't be of help in this case. All I do is change the network
block of docker-compose.yml to customise the default
network, rather than create a new one.
If I recall correctly, when looking for the solution to this issue I stumbled upon a few threads which mentioned the same (or adjacent) issues you are facing. The solution involved setting a static MAC address for the HyperV NAT Virtual Adapter. I'm sorry I cannot give you anything more concrete, but here are few links that might be worth looking at. They are not exactly answers to your question but might give you some ideas:
https://superuser.com/questions/1701567/how-to-add-a-static-ip-adress-to-a-virtual-machine-in-hyper-v-to-stop-changing-t https://superuser.com/questions/1815670/change-mac-adress-virtual-switch-windows-server-with-hyper-v
This issue has been open for 30 days with no updates. @grcusanz, @adrianm-msft, please provide an update or close this issue.
please provide an update
That woulkd be indeed awesome. It seems as if this breaks a lot of stuff for enough people.
Hi, we'll be able to provide updates in a few days.
Hi @adrianm-msft, we're eagerly awaiting good news! Also hoping whatever changes are being made to fix this issue would be present in Windows Server 2022 and the upcoming Windows Server 2025.
A fix for the issue is planned for the November release of Windows Server 2025. However, the fix for Windows Server 2022 will take a bit longer.
This issue has been open for 30 days with no updates. @grcusanz, @adrianm-msft, please provide an update or close this issue.
This was originally filed by user @marcusschroeder as docker/for-win#9999, but as it can be reliably reproduced on Windows 2010 (maybe 2004?) but not 1903, and as it only happens with Windows containers, we believe that it is a bug in the windows container code.
Original report:
services: service_a: image: mcr.microsoft.com/windows/servercore/iis ports:
80
service_b: image: mcr.microsoft.com/windows/servercore/iis ports:
My colleague @StefanScherer has reproduced it without docker compose, but with a second nat network as follows: