Error Codes Wiki

Docker Desktop Port Already in Use — Container Port Binding Conflicts on Windows

Warningapplication

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

  1. 1Find what is using the port: 'netstat -ano | findstr :8080' then check the PID in Task Manager
  2. 2Stop the conflicting process or change the container's port mapping: 'docker run -p 8081:80' instead of '-p 8080:80'
  3. 3For Hyper-V reserved ports: run 'netsh interface ipv4 show excludedportrange protocol=tcp' and choose an unreserved port
  4. 4Stop all Docker containers: 'docker stop $(docker ps -q)' to release all bound ports
  5. 5Disable IIS if not needed: 'iisreset /stop' or disable World Wide Web Publishing Service in services.msc

Tags

dockerport-conflictbind-failednetworkingcontainers

Related Items

More in Application

Frequently Asked Questions

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.