Report this

What is the reason for this report?

How to Fix 'Bind for 0.0.0.0:80 Failed' Error in Docker?

Posted on March 3, 2025

I’m trying to run an Nginx container on my server using the following command:

docker run -d -p 80:80 nginx

But I keep getting this error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint <container_id>:
Bind for 0.0.0.0:80 failed: port is already allocated.

How can I find out what’s causing this and free up the port so I can run my container?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0

Hi there,

That error means something is already using port 80 on your system. You can check which process is using it with:

sudo netstat -tulnp | grep :80

or

sudo lsof -i :80

If it’s Nginx or Apache, you can stop it:

sudo systemctl stop nginx
# or
sudo systemctl stop apache2

If you don’t want to stop the service, run your container on a different port, like this:

docker run -d -p 8080:80 nginx

Then access it at http://localhost:8080.

Let me know if you’re still stuck! 🚀

- Bobby

Often this happens when a web server like Apache is pre-installed and running on the system. Disabling it using sudo systemctl stop apache2 (or httpd, depending on the OS) usually solves the issue.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.