Conflict container name 🐳 Docker

Conflict. The container name "/x" is already in use by container …

A container (running or stopped) already has that name; Docker won’t create a second one with the same name.

Seen on: Docker

Meaning

Stopped containers keep their names until removed. Scripts that use docker run --name x fail on the second run unless they remove the old container first.

Common causes

  • Old stopped container with the same name
  • Script/CI re-running docker run --name without cleanup
  • Compose project renamed, leaving old containers

⚡ Quick fix

  1. Remove it: docker rm -f x
  2. Use docker run --rm for one-off containers
  3. Use Compose, which replaces containers on up

Detailed fix by platform

Docker

  1. Idempotent run in scripts:
    bash
    docker rm -f api 2>/dev/null || true
    docker run -d --name api -p 8080:8080 ghcr.io/acme/api:latest

How to diagnose

  1. Existing — docker ps -a --filter name=x
  2. Script — Does it clean up before run?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.