How to fix Cannot start service app: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0 in Docker

DockerBEGINNERLOWUpdated Dec 1, 2025ยท 322 views

This error occurs when Docker cannot bind a container port to your host machine because the port is already in use by another process or blocked by the operating system.

Quick fix

Fixes Cannot start service app: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0

# Check what's using port 80
sudo lsof -i :80

# Alternative using netstat
sudo netstat -tlnp | grep :80
  1. Identify what is using the port
  2. Stop the conflicting process or service
  3. Check for zombie Docker containers
  4. Use a different port (quick workaround)
docker โ€” error
# Check what's using port 80
sudo lsof -i :80
# Alternative using netstat
sudo netstat -tlnp | grep :80
Cannot start service app: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0

What this error means

When you run a Docker container with port mapping (e.g., `-p 80:80` or in docker-compose.yml), Docker attempts to bind the specified host port to the container port. This error appears when that binding fails. The "Ports are not available" error typically means: - Another application or service is already using that port on your host machine - A previous Docker container that didn't shut down cleanly is still holding the port - On Windows, the WinNAT service or Hyper-V has reserved the port range - On macOS Monterey+, system services like AirPlay Receiver may occupy common ports The error message format usually looks like: "Ports are not available: exposing port TCP 0.0.0.0:PORT -> 0.0.0.0:0: listen tcp 0.0.0.0:PORT: bind: address already in use" or on Windows it may show "An attempt was made to access a socket in a way forbidden by its access permissions."

Typical symptoms

  • Docker container fails to start with 'Ports are not available' error
  • docker-compose up fails when trying to expose ports
  • Error message contains 'bind: address already in use'
  • On Windows: error mentions 'access permissions' for socket
  • Container works when using a different port number
  • Port conflict appears after system restart or Docker Desktop update

Common causes

  1. Another application is already using the requested port (web servers, databases, etc.)
  2. A previous Docker container is still running or didn't release the port cleanly
  3. On Windows: Hyper-V has reserved dynamic port ranges that include your target port
  4. On Windows: WinNAT service is blocking the port binding
  5. On macOS Monterey+: AirPlay Receiver is using port 5000 or 7000
  6. System services like Apache, nginx, or IIS are running and using common ports
  7. Firewall or security software is blocking the port allocation
  8. Duplicate port bindings in docker-compose.yml or docker run command

How to fix "Cannot start service app: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0"

1Identify what is using the port

First, find out which process is occupying the port you need:

On Linux/macOS:

bash
# Check what's using port 80
sudo lsof -i :80

# Alternative using netstat
sudo netstat -tlnp | grep :80

On Windows (PowerShell as Administrator):

powershell
# Find process using port 80
netstat -ano | findstr :80

# Get process name from PID
Get-Process -Id <PID>

Note the process name and PID. If it's a service you don't need, you can stop it.

2Stop the conflicting process or service

Once you've identified the process, stop it:

On Linux:

bash
# Kill by PID
sudo kill -9 <PID>

# Or stop common services
sudo systemctl stop apache2
sudo systemctl stop nginx

On macOS:

bash
# Kill by PID
sudo kill -9 <PID>

# Stop Apache if running
sudo apachectl stop

On Windows (PowerShell as Administrator):

powershell
# Kill by PID
Stop-Process -Id <PID> -Force

# Or stop IIS
Stop-Service W3SVC
3Check for zombie Docker containers

A previous container might still be holding the port:

bash
# List all containers including stopped ones
docker ps -a

# Remove stopped containers
docker container prune

# Or remove a specific container
docker rm <container_id>

# Force remove if it's stuck
docker rm -f <container_id>

If using docker-compose:

bash
# Stop and remove containers
docker-compose down

# Then start fresh
docker-compose up -d
4Use a different port (quick workaround)

The fastest solution is often to use a different host port:

Docker run:

bash
# Map host port 8080 to container port 80
docker run -p 8080:80 your-image

docker-compose.yml:

yaml
services:
  web:
    image: nginx
    ports:
      - "8080:80"  # Host port 8080 -> Container port 80

Then access your application at http://localhost:8080 instead of port 80.

5Windows-specific: Restart WinNAT service

On Windows, the WinNAT service can block ports. This is a common fix:

Open PowerShell as Administrator and run:

powershell
# Stop WinNAT
net stop winnat

# Start your Docker container
docker-compose up -d
# or
docker start <container_name>

# Restart WinNAT
net start winnat

This temporarily releases ports held by WinNAT, allowing Docker to bind to them.

6Windows-specific: Fix Hyper-V reserved port ranges

Hyper-V reserves dynamic port ranges that may include common ports like 80, 443, or 3000. To fix this permanently:

Check excluded port ranges:

powershell
netsh interface ipv4 show excludedportrange protocol=tcp

Reset the dynamic port range to avoid conflicts:

powershell
# Run as Administrator
netsh int ipv4 set dynamic tcp start=49152 num=16384
netsh int ipv6 set dynamic tcp start=49152 num=16384

Reserve your specific port before Hyper-V does:

powershell
# Disable Hyper-V temporarily
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
# Restart

# Reserve your port
netsh int ipv4 add excludedportrange protocol=tcp startport=80 numberofports=1

# Re-enable Hyper-V
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
# Restart
7macOS-specific: Disable AirPlay Receiver

On macOS Monterey and later, AirPlay Receiver uses ports 5000 and 7000 by default:

1. Open System Preferences (or System Settings on macOS Ventura+)
2. Go to Sharing (or General > AirDrop & Handoff)
3. Uncheck AirPlay Receiver

Alternatively, check if Control Center is using your port:

bash
lsof -i :5000

If you see "ControlCe" in the output, that's the AirPlay Receiver.

8Restart Docker Desktop

Sometimes Docker Desktop itself has stale port bindings:

On Windows/macOS:
1. Right-click the Docker whale icon in the system tray
2. Select Restart
3. Wait for Docker to fully restart
4. Try running your container again

On Linux:

bash
sudo systemctl restart docker

After restarting, verify Docker is running:

bash
docker info

Advanced notes

Checking all port bindings at once:

bash
# Linux/macOS - show all listening ports
sudo lsof -i -P -n | grep LISTEN

# Windows
netstat -an | findstr LISTENING

Docker port range configuration:
If you frequently hit port conflicts, consider configuring Docker to use specific port ranges. In daemon.json:

json
{
  "default-address-pools": [
    {"base":"172.80.0.0/16","size":24}
  ]
}

Avoiding port conflicts in CI/CD:
Use dynamic port assignment by leaving the host port empty:

yaml
ports:
  - "80"  # Docker assigns an available host port

Then use docker port <container> 80 to discover the assigned port.

WSL2 port forwarding issues:
If you're using Docker with WSL2 and can't access ports from Windows:

powershell
# Get WSL IP
wsl hostname -I

# Add port proxy if needed
netsh interface portproxy add v4tov4 listenport=80 listenaddress=0.0.0.0 connectport=80 connectaddress=<WSL_IP>

Kubernetes/Minikube conflicts:
If you have Minikube or Kubernetes running, they may reserve ports. Check with:

bash
kubectl get svc --all-namespaces

Frequently asked questions

What does "Cannot start service app: Ports are not available: exposing port TCP 0" mean?
yml), Docker attempts to bind the specified host port to the container port. This error appears when that binding fails.
How do I fix "Cannot start service app: Ports are not available: exposing port TCP 0"?
This error occurs when Docker cannot bind a container port to your host machine because the port is already in use by another process or blocked by the operating system.
What causes "Cannot start service app: Ports are not available: exposing port TCP 0"?
Another application is already using the requested port (web servers, databases, etc.) A previous Docker container is still running or didn't release the port cleanly On Windows: Hyper-V has reserved dynamic port ranges that include your target port
Is the "Cannot start service app: Ports are not available: exposing port TCP 0" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading