I use Docker and Docker compose to run my Laravel setup locally on Windows using WSL2. One fine day, I got this error below and my docker containers would not work.

2023-04-07 10:48:49 [07-Apr-2023 08:48:49] NOTICE: Failed implicitly binding to ::, retrying with 0.0.0.0
2023-04-07 10:48:49 [07-Apr-2023 08:48:49] NOTICE: Failed implicitly binding to ::, retrying with 0.0.0.0
2023-04-07 10:48:49 [07-Apr-2023 08:48:49] ERROR: unable to bind listening socket for address '9000': Address already in use (98)
2023-04-07 10:48:49 [07-Apr-2023 08:48:49] ERROR: unable to bind listening socket for address '9000': Address already in use (98)
2023-04-07 10:48:49 [07-Apr-2023 08:48:49] ERROR: FPM initialization failed
2023-04-07 10:48:49 [07-Apr-2023 08:48:49] ERROR: FPM initialization failed

To identify the cause, I ran a command on Powershell to find which process is running on this port.

 Get-Process -Id (Get-NetTCPConnection -LocalPort 9000).OwningProcess

Which gave me this result


Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   1926     168  3334352    1776924     821.08  14252   1 phpstorm64

On looking up online, turns out PHPStorm runs its own debugging server on port 9000 by default. I went to settings, searched for built in server and changed the port number. This issue could have been caused by the latest upgrade to PHPStorm 2023.1.

How to change the default port for PHP Built-in Server in PHPStorm