I am on Mac. Trying to run a docker example Following this documentation: https://docs.docker.com/docker-for-mac/
This is my command:
docker run -d -p 80:80 --name webserver nginx
But i am getting 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).
Need help.
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
Try restarting docker. That usually works for me.
Recently this problem started to happen a lot on Windows. You can try restarting docker or you can manually stop docker before Windows shutdown - docker starts cleanly on reboot. On 7/24/2018 docker issue is open and further details can be found at https://github.com/docker/for-win/issues/1967
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
windows users: docker description
On Windows systems, CTRL+C does not stop the container. So, first type
CTRL+C to get the prompt back (or open another shell), then type
docker container ls to list the running containers, followed by docker
container stop to stop the container.
Otherwise, you get an error response from the daemon when you try to
re-run the container in the next step.
I had the same problem, I thought with CTRL+C stoped the container but it was not the case, any af the answer above works because they all stop containers, restarting docker or stoping container explicity.
I prefer:
docker container ls #list containers running
docker stop [container id] #replace [container id] with the container id running