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?
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
If you are the port i not in use, try restarting docker. That usually works for me.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With