ProjectStack
docker

Error response from daemon: endpoint with name X already exists in network Y

A container with the same name is already registered on the Docker network, even if it's stopped. Docker tracks container endpoints on named networks, and you can't start a new container with the same name while the old one's network endpoint still exists.

Common causes

  • A container with the same name was stopped but not removed — stopped containers still hold their network endpoints
  • Docker Compose is restarting a service but the old container wasn't fully cleaned up
  • A deploy or CI run created a container that wasn't removed after a previous run
  • Two containers in the same Compose file or stack are accidentally given the same name

How to fix it

  1. Remove the old stopped container: docker rm CONTAINER_NAME
  2. In Docker Compose: docker-compose down before docker-compose up to cleanly recreate containers
  3. Use --force-recreate with Compose to always recreate: docker-compose up --force-recreate
  4. List all containers including stopped ones to find the conflict: docker ps -a --filter name=CONTAINER_NAME

Example

$ docker run --name myapp --network mynet myimage docker: Error response from daemon: endpoint with name myapp already exists in network mynet.

A stopped container named myapp is still registered on the mynet network

Browse more errors

The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.