Docker Core

The daemon could not bind the published host port because another holder keeps it.

port-is-already-allocated
MediumContainer Platform

Reviewed for reference consistency: August 11, 2026

The daemon could not bind the published host port because another holder keeps it.

What port-is-already-allocated Means

The port-is-already-allocated error on the Docker Core indicates the daemon could not bind the published host port because another holder keeps it.. This typically occurs due to another container already publishes the same host port.

Publishing a container port asks the daemon to bind that port on the host. Docker tracks allocations across all containers, and when the requested port is already bound by another container the daemon refuses with the port-is-already-allocated wording inside its bind error.

How to fix port-is-already-allocated

General informational guidance, not professional advice. Commands can affect your system or data — back up first and proceed at your own risk. FixerCode is an independent reference, not affiliated with any vendor mentioned.

  1. List which containers publish which ports

    The ports column in the process listing maps container ports to host bindings, exposing the conflicting pair.

    docker ps --format 'table {{.Names}}\t{{.Ports}}'
  2. Identify the host process on the port

    The socket listing shows the owning PID for listeners on the printed port, separating Docker bindings from foreign services.

    ss -ltnp 'sport = :8080'

Technical Background

The message comes from the daemon's port allocator rather than from the kernel: Docker refuses the bind as soon as its own bookkeeping shows a conflict, even before attempting the system call.

Only one process can hold a TCP port on an interface, and containers count as processes here. The allocator's view can briefly diverge after unclean shutdowns, which is why a phantom allocation sometimes survives until the stale container is cleared.

Common Causes

  • Another container already publishes the same host port
  • A host process outside Docker listens on the port
  • A stopped-but-not-removed container keeps its port reservation
  • The compose file pins identical host ports for two services

Typical Scenarios

  • Starting a second web container with the same host port while the first still runs
  • A compose up against services whose fixed host ports overlap
  • A crashed container whose process is gone but whose binding lingers in daemon state

What to Know

The binding printed in the error names the exact host address and port involved; cross-referencing it with running containers separates a container conflict from a foreign host process.

Frequently Asked Questions

Common questions about Docker port-is-already-allocated error

Distinct host addresses or a load-balancing layer make it possible; the allocator binds each address-port pair exactly once.

A stopped container no longer holds the binding; a container stuck mid-removal can keep the allocation until it is cleaned up.

Related Error Codes

Related Errors From Other Categories

Similar error codes documented across different platforms and systems