I have a problem with DDEV. I’m running Docker Desktop 4.13.1, DDEV 1.21.3, WSL2, and Windows 11. After updating Docker Desktop 4.18.0 to and DDEV to 1.21.6, I encountered a problem with ports.
There are several situations, but in each case, the my-site.ddev.site page doesn’t work.
First case:
The ports I have set:
router_http_port: "80"
router_https_port: "443"
Error:
Error response from daemon: Ports are not available: exposing port TCP 127.0.0.1:443 -> 0.0.0.0:0: listen tcp 127.0.0.1:443: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
Failed to start my-site: failed to start ddev-router: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-my-site docker-compose -f /home/hp/.ddev/.router-compose-full.yaml -p ddev-router up -d', action='[-p ddev-router up -d]', err='exit status 1', stdout='', stderr='Container ddev-router Creating
Container ddev-router Created
Container ddev-router Starting
Error response from daemon: Ports are not available: exposing port TCP 127.0.0.1:443 -> 0.0.0.0:0: listen tcp 127.0.0.1:443: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.'
Second case:
When I change the ports to:
router_http_port: "8000"
router_https_port: "8443"
DDEV starts up, but when I go to the my-site.ddev.site page, Chrome (and other browsers) returns an error:
The my-site.ddev.site server unexpectedly terminated the connection.
I tried manually adding 127.0.0.1 my-site.ddev.site to the hosts file (C:WindowsSystem32driversetchosts
), but unfortunately, it didn’t work.
127.0.0.1 my-site.ddev.site
I downgraded Docker from 4.18.0 to 4.13.1 and DDEV from 1.21.6 to 1.21.3, but it didn’t help.
I also tried starting the DDEV project on port 443 and 80 using the following method:
Win11 PowerShell net stop winnat
WSL2 ddev start
Win11 PowerShell net start winnat
but that also didn’t work.
I also tried:
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns
And it also did nothing. I have tried a lot of methods, but none of what I tried worked. What I wrote above are most common solutions I found online.
Unfortunately ChatGPT also doesn’t know any reasonable solution.
2
Answers
Updating WSL2 to pre-release and reinstalling DDEV helped. Solution:
WSL2 has been having some rough times with recent upgrades, and it sounds like you have some of those going on.
Please take a look at https://github.com/ddev/ddev/issues/4809
Also https://github.com/ddev/ddev/issues/4573
You may want to consider moving from Docker Desktop to Docker-inside-WSL2, but I’m not sure that will affect these issues. If you do that, make sure you have database dumps or snapshots.