Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker: driver failed programming external connectivity on endpoint webserver

Tags:

docker

I am trying to run a docker example following this documentation

This is my command:

docker run -d -p 80:80 --name webserver nginx

But I get this error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint webserver (bd57efb73c738e3b271db180ffbee0a56cae86c8193242fbc02ea805101df21e): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE).

How do I fix this?

like image 291
Istiak Morsalin Avatar asked Sep 15 '16 09:09

Istiak Morsalin


3 Answers

From your error message, the EADDRINUSE indicates port 80 is already in use on either the docker VM or possibly directly on your laptop. You can either stop whatever is running on that port, or change the port used in your Docker, command. To change to the external port 8080, use:

docker run -d -p 8080:80 --name webserver nginx
like image 198
BMitch Avatar answered Nov 07 '22 23:11

BMitch


If you are the port i not in use, try restarting docker. That usually works for me.

enter image description here

like image 91
Lone Ronin Avatar answered Nov 07 '22 22:11

Lone Ronin


I had the same issue with one of my containers. I tried everything but when nothing worked, I tried the following and launched the container again with success

 sudo service docker stop
 sudo rm /var/lib/docker/network/files/local-kv.db
 sudo service docker start
like image 44
smishra Avatar answered Nov 07 '22 23:11

smishra