Why is Localhost 5000 Forbidden?
Port 5000 has a unique problem compared to other ports: Operating System Conflicts.
1. macOS Users: AirPlay Receiver Conflict
If you are on macOS Monterey or newer, "ControlCenter" is using port 5000 for AirPlay. This prevents Flask from starting.
Option A: Disable AirPlay (Recommended)
- Open System Settings > General > AirDrop & Handoff.
- Toggle "AirPlay Receiver" to OFF.
Option B: Kill the Process (Temporary)
lsof -i :5000
# You will see 'ControlCenter'
kill -9 [PID]
# You will see 'ControlCenter'
kill -9 [PID]
2. Python Flask Binding
By default, Flask runs on 127.0.0.1:5000. Sometimes accessing via localhost fails due to DNS resolution.
Fix: Try clicking this direct IP link instead:
http://127.0.0.1:5000Or run Flask on a different port to avoid conflicts completely:
flask run --port 5001
3. Docker Registry
If you are trying to push/pull images locally, ensure the Docker Registry container is actually running.
docker ps | grep registry
If it is not running, start it mapping port 5000:
docker run -d -p 5000:5000 --name registry registry:2