for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Unable to bind to high port numbers like 50000 on Windows

Open hmedney opened this issue 7 years ago • 7 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: 869A6392-F726-4932-8B55-E327954D3CA8/20190104133745

Expected behavior

Running a container bound to port 50000 on Windows will work.

Actual behavior

> docker run -p 50000:50000 hello-world
docker: Error response from daemon: driver failed programming external connectivity on endpoint pedantic_heisenberg (42fdd4980983b5cce52ef21296c28bde3b2d943088ca89d18d45d2355bc41ac7): Error starting userland proxy: Bind for 0.0.0.0:50000: unexpected error Permission denied.

Information

  • Windows Version: 1809
  • Docker for Windows Version: Docker version 18.09.0, build 4d60db4

Interestingly, the last usable port is somewhere between 49700 and 49800:

> docker run -p 49700:49700 hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
...

> docker run -p 49800:49800 hello-world
docker: Error response from daemon: driver failed programming external connectivity on endpoint cranky_easley (f60c2bf13f72d14d077ab499c06cf3fbab5081e2f942012c25b9b3b303d81a52): Error starting userland proxy: Bind for 0.0.0.0:49800: unexpected error Permission denied.

Steps to reproduce the behavior

  1. ...
  2. ...

hmedney avatar Jan 04 '19 18:01 hmedney

This was a local machine issue which had some odd networking settings. After fixing the settings, Docker was allowed to bind to high ports like 50000.

hmedney avatar Jan 09 '19 05:01 hmedney

@hmedney I'm having the same problem, can you share what those "odd networking settings" were? Thanks !

liberdis avatar Mar 12 '19 14:03 liberdis

This was a local machine issue which had some odd networking settings. After fixing the settings, Docker was allowed to bind to high ports like 50000.

I would love to know what you did to resolve this. I just bumped into this problem as well.

jorgensigvardsson avatar Mar 12 '19 18:03 jorgensigvardsson

I found the solution over at Stack Overflow: https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-to-permission-denied

The reason is that Hyper-V takes over these ports, to prevent it from happening do the following:

  1. dism.exe /Online /Disable-Feature:Microsoft-Hyper-V (will have to restart)
  2. netsh int ipv4 add excludedportrange protocol=tcp startport= numberofports=1
  3. dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

jorgensigvardsson avatar Mar 12 '19 18:03 jorgensigvardsson

netcfg -d --this will clean up all networking devices, and requires a reboot

https://github.com/docker/for-win/issues/1804 @jorgensigvardsson @liberdis

escalonc avatar May 08 '19 03:05 escalonc

s, and requires a reboot

this kills my network stack

inidona avatar Dec 09 '19 14:12 inidona

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jul 04 '20 03:07 docker-robott