Question

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

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?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 4, 2025
Accepted Answer

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

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.