Port 5000 is Flask's default development server port and a common alternative dev port to 3000. Docker Registry also uses port 5000. On macOS, Apple AirPlay Receiver occupies port 5000, causing conflicts with Flask development. Port 5000 should never be exposed publicly when used as a development server.
Port Number
5000
Protocol
TCP
Service
Flask / Generic Dev HTTP
Range
Unofficial
Find what process is using port 5000 (macOS AirPlay vs Flask)
lsof -i :5000Test if Docker Registry is running on 5000 (returns {})
curl -s http://localhost:5000/v2/ | jq .Check if Flask is responding
curl -s http://localhost:5000/ -o /dev/null -w '%{http_code}'flask run # http://localhost:5000
python app.py # Flask default
docker run -p 5000:5000 registry:2Port 5000 became Flask's default in 2010 when Armin Ronacher created the framework. Docker Registry adopted it in 2014. Apple's AirPlay Receiver claiming port 5000 in macOS Monterey (2021) caused widespread developer frustration.
How do I fix 'Address already in use' on port 5000 on macOS?
macOS Monterey+ runs AirPlay Receiver on port 5000. Disable it: System Settings > General > AirDrop & Handoff > AirPlay Receiver: off. Or use a different port: flask run --port 5001.
Is Flask's dev server safe for production?
Absolutely not. It is single-threaded, has no request timeouts, no worker management, and Werkzeug debug mode can enable RCE. Production: gunicorn --bind 127.0.0.1:5000 --workers 4 app:app behind Nginx with TLS on 443.