Ports are not available: exposing port TCP the all-interfaces address:8080: bind: address already in use
Fixes 'Ports are not available' when docker cannot expose a host port. Use when the daemon reports a port as unavailable at container start, typically a conflict with another container or host service. Not for firewall blocks or container-internal listen failures.
TL;DR: The host port is taken. Identify the holder with docker ps and ss -tlnp, then either stop it or publish a different host port. This message is the newer daemon wording for the classic port conflict; the fix is identical to the older 'port is already allocated' error.
The error
Ports are not available: exposing port TCP the all-interfaces address:8080 -> the all-interfaces address:0: listen tcp4 the all-interfaces address:8080: bind: address already in useFix it
- Check running containers first:
docker ps --filter "publish=8080" Expected: the conflicting container, if any.
- Then host processes:
sudo ss -tlnp | grep ':8080' Expected: process and PID.
- Resolve by stopping the holder or remapping:
docker run -p 8081:8080 [image] Expected: starts cleanly.
When this applies
docker run -pfailing with "Ports are not available"- Docker Desktop and Engine 24+ which use this wording
When this does NOT apply
- Container app failing to bind its OWN port (that is inside the container; check the app config)
- "port is already allocated" (older wording, same fix)
Versions
Docker Engine 23+, Docker Desktop 4.20+.
Why it happens
The daemon pre-validates port availability before creating the container's network endpoint. Anything in the host network namespace already bound to that port, including a previous instance of the same container, trips the check.
Edge cases
- Docker Desktop on Mac/Windows: the "host" here is the Linux VM; a process inside the VM (rare) or the port-forwarding layer can be the holder.
- Ephemeral port exhaustion on busy hosts can produce this for high port numbers; check
cat /proc/sys/net/ipv4/ip_local_port_range. - Restart policies can recreate the conflict automatically;
docker update --restart=nothe old container before remapping.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.