Search code examples
docker

docker: driver failed programming external connectivity on endpoint webserver


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?


Solution

  • 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