Docker | An attempt was made to access a socket in a way forbidden
Running into a problem
For a project I was using the local supabase cli to run the development environment locally. Everthing worked fine until one day where the startup was intrerrupted by the following message:
Error: Error response from daemon: Ports are not available:
listen tcp 0.0.0.0:54322: bind:
An attempt was made to access a socket in a way forbidden by its access permissions.
At first I was really disappointed as I did not change anything myself. But after a quick search and check I found the solution for my problem.
Windows Update changed the reserved port ranges
I'm sure you are here because you are seeing this error too and are wondering why. Let me describe the issue to you.
The reason is most likely due to a regular Update of Windows that restricted the usage of a certain port range on your machines. You can view a list of which ports are excluded from your user by running this command in your command line:
netsh interface ipv4 show excludedportrange protocol=tcp
The output on my machine looks like this:
C:\****>netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
49691 49790
49791 49890
49891 49990
50000 50059 *
54152 54251
54252 54351
54352 54451
* - Administered port exclusions.
After changing the configuration of the supabase ports, everything works again.