Another container already publishes that host port
CommonThe most common case, and often a previous run of the same stack that was never stopped. Compose projects with different names will happily run side by side and collide on ports.
Confirm
docker ps --format 'table {{.Names}} {{.Ports}}' | grep -F ':8080'Any container listing `0.0.0.0:8080->` in its ports.
Fix
- Stop the container that holds it, or publish this one on a different host port — the container port does not need to change.
- For a duplicated compose stack, bring the old one down with `docker compose down` rather than stopping containers individually, so networks and orphans go too.
docker run -p 8081:3000 myapp # host port changed, container port unchanged
Only the left-hand number is contended. The application inside still listens on 3000.