tasneem almoallem
tasneem almoallem

Reputation: 3

Docker container doesn't run on windows , Ports are not available

I was trying to run the docker container on windows 10 but I always get this error "Cannot start service SERVICE_NAME: Ports are not available: unable to list exposed ports: Get "http://unix/forwards/list": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" . I tried deleting the container and rebuilding it again but that is not working for me.

PS: this error is not related to a specific service, each time happens in a different service although the same service was started successfully before

Any help, please?

Upvotes: 0

Views: 1844

Answers (2)

David Izhak
David Izhak

Reputation: 51

The problem is Hyper-V in Windows, which reserves a range of ports for its needs. This range may overlap with ports that Docker images use.

You need to run the following commands in CMD or PowerShell:

netsh int ipv4 set dynamic tcp start=49152 num=16384
netsh int ipv6 set dynamic tcp start=49152 num=16384

After executing the commands, you must restart your computer.

This will forcefully limit the range from which Hyper-V can reserve ports for its needs. Of cause Docker images shouldn't use ports from 49152 to 65536 because this range can be used by Hyper-V or Windows.

Upvotes: 0

Oleg Orlov
Oleg Orlov

Reputation: 46

This helped me solve the same problem

netsh winsock reset

Upvotes: 2

Related Questions