Docker Desktop Port Already in Use — Container Port Binding Conflicts on Windows
About Docker Desktop Port Already in Use
Fix Docker Desktop port conflict errors when containers fail to start because another process or service is already using the required port on Windows. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Docker containers bind ports to the host system — only one process can listen on a specific port. Error message: 'Bind for 0.0.0.0:xxxx failed: port is already allocated'. Common conflicting services: IIS (80/443), SQL Server (1433), MySQL (3306), PostgreSQL (5432). Windows may reserve port ranges for Hyper-V that conflict with Docker container ports. Docker Compose services may conflict with each other or with previously running containers. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Another application or service already listening on the container's mapped port. Windows Hyper-V reserving port ranges that include the desired container port. Previous Docker container still running and holding the port even after the app crashed. IIS or Windows web services automatically starting and binding to port 80/443. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Find what is using the port: 'netstat -ano | findstr :8080' then check the PID in Task Manager. Stop the conflicting process or change the container's port mapping: 'docker run -p 8081:80' instead of '-p 8080:80'. For Hyper-V reserved ports: run 'netsh interface ipv4 show excludedportrange protocol=tcp' and choose an unreserved port. Stop all Docker containers: 'docker stop $(docker ps -q)' to release all bound ports. Disable IIS if not needed: 'iisreset /stop' or disable World Wide Web Publishing Service in services.msc. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Windows Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
How do I see all ports in use?
Run 'netstat -ano' for all connections, or 'netstat -ano | findstr LISTENING' for active listeners. The last column is the PID — cross-reference with Task Manager > Details tab.
Overview
Fix Docker Desktop port conflict errors when containers fail to start because another process or service is already using the required port on Windows.
Key Details
- Docker containers bind ports to the host system — only one process can listen on a specific port
- Error message: 'Bind for 0.0.0.0:xxxx failed: port is already allocated'
- Common conflicting services: IIS (80/443), SQL Server (1433), MySQL (3306), PostgreSQL (5432)
- Windows may reserve port ranges for Hyper-V that conflict with Docker container ports
- Docker Compose services may conflict with each other or with previously running containers
Common Causes
- Another application or service already listening on the container's mapped port
- Windows Hyper-V reserving port ranges that include the desired container port
- Previous Docker container still running and holding the port even after the app crashed
- IIS or Windows web services automatically starting and binding to port 80/443
Steps
- 1Find what is using the port: 'netstat -ano | findstr :8080' then check the PID in Task Manager
- 2Stop the conflicting process or change the container's port mapping: 'docker run -p 8081:80' instead of '-p 8080:80'
- 3For Hyper-V reserved ports: run 'netsh interface ipv4 show excludedportrange protocol=tcp' and choose an unreserved port
- 4Stop all Docker containers: 'docker stop $(docker ps -q)' to release all bound ports
- 5Disable IIS if not needed: 'iisreset /stop' or disable World Wide Web Publishing Service in services.msc