How to fix Docker Daemon Port Binding Error in Windows

2024-01-17 Antonio Canzanella

Problem Overview

When working with Docker on Windows, you might encounter the following error when trying to bind ports:

    Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:54328 -> 0.0.0.0:0: listen tcp 0.0.0.0:54328: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
    

This error indicates that Docker is unable to bind to the specified port due to access restrictions set by Windows.

Solution

To resolve this issue, you can restart the win service, which will release the ports and allow Docker to bind to them again. Follow these steps:

Open CMD As Admin and run in sequence:
    
    net stop winnat
    net start winnat