Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied

I am running the latest Docker CE, 17.09, under Windows 10 Pro, and using two different examples am getting Permission denied.

Docker site example: docker run -d -p 80:80 --name webserver nginx

AWS site Docker example: docker run -p 80:80 hello-world

both returned the same error.

docker: Error response from daemon: driver failed programming external connectivity on endpoint XXXXX: Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied.


I solved my issue on Windows 10 Pro, turned out I had the World Wide Web Publishing Service turned on somehow. Took me a while to find that, after noting via netstat -a -n that I had a :80 listener somewhere/somehow. Silly me. Shut it down, and I was fine with port 80.


Change the port using these commands as follow:

docker container ls //show the container infos, note the ports info.

docker stop webserver

docker rm webserver  //shut down currently webserver

docker run -d -p 8080:80 --name webserver nginx (or 8000:80)

Finally, let's input localhost:8080 to show whether the connection is successful in the browser.

enter image description here


The problem is general-use ports like 80, 443, 22, .. (in general ports < 1024) are system-protected so you need privileges to use them, here it'll be enough to be a system administrator and execute command as a administrator.

If it doesn't have to be :80 try using other port, like :8080, if that doesn't help and the error doesn't change, the problem goes deeper.


On macOS Mojave Version 10.14.2 this command worked for me:

sudo apachectl stop

Before executing this command, run

sudo lsof -i -P | grep "LISTEN"

and check if httpd is the identifier of the listener on :80 e.g.:

the second line is httpd listener on port :80

If it is, then it's actually the Mac apache that causes the problem.


The First course of action that you should take is to run the command:

netstat -aon | findstr [port#]

This will tell you if a process is running on the given port. If that is the case then you can kill the process with the command:

taskkill /PID [PID] /F

This will kill the process using that port. You will then be able to bind a new process to the port.

I also had come across a time when netstat -aon did not return that a process was running for a port that I desired to use but it certianly had a process running on it was wasn't allowing me to run a new process on the port. I was able to remedy the problem with the following:

Start Windows in Safe Mode with Networking

In powershell/cmd run the command:

netsh int ipv4 add excludedportrange protocol=tcp startport=[PORT] numberofports=1

This will reserve the port so when you boot back into normal windows mode no application will steal the port before you can use it.