Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use

Viewed 13491

I am trying to follow a tutorial for Docker beginners (https://docs.docker.com/get-started/)

When I try to run this command: $ docker run -d -p 80:80 docker/getting-started

I get this Error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint suspicious_murdock (863f389a032ea76d187c4387701b9eb0b6d4de4d0a9ed414616fa6b4715346ab): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.

I tried removing all the dockers docker rm -fv $(docker ps -aq) but it did nothing.

What can I do?

3 Answers

I had to stop apache2 from running on port :80 - sudo service apache2 stop

Or you can use a different port like docker run -d -p 8080:80 docker/getting-started. This way you do not need to stop the apache2 running on the host.

In case you change ports and still encounter the same problem especially on Ubuntu 18 try stopping your apache serve and mysql port if you further encounter mysql port already been used. Try these two commands.

sudo service apache2 stop

sudo service mysql stop

Related