Interview Prep/Networking/Containers, Kubernetes, IPv6 and packet captures

`docker run -p 80:80 nginx` fails with `Bind for 0.0.0.0:80 failed: port is already allocated`.

BeginnerTroubleshootingContainers, Kubernetes, IPv6 and packet captures
Answer

Likely causes → Another container already publishes host port 80, or a host process (nginx, Apache) listens on it.

Diagnose →

docker ps --format '{{.Names}}\t{{.Ports}}' | grep ':80->'
sudo ss -ltnp 'sport = :80'

Fix → Stop the conflicting container/service, or publish a different host port (-p 8081:80). If no container shows it but the error persists, a stale docker-proxy may hold it; restarting Docker clears that.

Prevent → Put a single reverse proxy on 80/443 and keep app containers on unpublished ports in a shared network.

All Networking questions Roadmap: Networking for DevOps

More on Containers, Kubernetes, IPv6 and packet captures