Hostxpeed
Login Get Started →
Troubleshooting

Fix Docker "Port Already Allocated"

3 min read
29 views
Jun 10, 2026

Understanding the Error

docker: Error response from daemon: port is already allocated

Fix 1: Find What's Using the Port

# Check all Docker containers using port
docker ps --filter "publish=80"
docker ps -a | grep 80

# Check host processes
sudo lsof -i :80
sudo netstat -tlnp | grep :80

Fix 2: Stop Conflicting Container

# Stop specific container
docker stop container_name

# Remove it
docker rm container_name

Fix 3: Stop All Containers Using Port

# Find PIDs using port 80
sudo fuser -k 80/tcp

Fix 4: Use Different Host Port

# Instead of -p 80:80, use:
docker run -p 8080:80 nginx

# Now access on port 8080

Fix 5: Check for Stopped Containers

# Stopped containers still reserve ports
docker ps -a

# Remove all stopped containers
docker container prune

# Remove specific
docker rm container_id

Fix 6: Docker Network Conflict

# Check networks
docker network ls

# Remove unused networks
docker network prune

Fix 7: Reset Docker

sudo systemctl restart docker

Was this article helpful?