docker: "bind: address already in use" — Find the Squatter

Symptom

Container fails to start; port already bound.

Root cause

Another process (or a stale container) owns the port.

Fix, in order

1. Find who owns itss -tlnp | grep :<port>
2. Check stale containers firstdocker ps -a --filter "status=exited"
3. Remap instead of killing system servicesdocker run -p 8080:80 nginx
4. On macOS: port 5000/7000 is usually AirPlaySystem Settings > AirDrop & Handoff > off, or remap

Prevent it coming back

Centralize port allocation in one compose file.

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

Managed cloud hosting

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog