Menü schliessen
Created: August 7th 2024
Last updated: August 8th 2024
Categories: Common Web Development,  Docker,  IT Development,  IT Support
Author: Tim Fürer

[Ubuntu / Linux Mint] Docker error bind port TCP 0.0.0.0:80 already in use by apache2

Tags:  Apache,  docker,  Linux,  Ubuntu
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

Docker users on Ubuntu or Linux Mint may encounter an error attempting to run a Docker container that uses port 80 reading something along the lines of:

Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0: listen tcp 0.0.0.0:80: bind: address already in use

Some Ubuntu and Linux Mint installations seem to run the Apache2 service by default, resulting in port 80 getting blocked. You can confirm this by visiting "localhost" in a web browser, which will display an Apache2 manual page by Ubuntu:

The fix is easy; stop Apache2 from running (on startup).

  1.  Stop Apache2:
    sudo systemctl stop apache2
  2. Disable Apache2 (so that it will no longer boot alongside your system):
    sudo systemctl disable apache2
  3. [optional] Verify that port 80 is free now:
    sudo lsof -i :80

You should now be able to start your Docker container without facing any issues regarding port 80 being blocked or unavailable.