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.
is already in use by containercontainer name already in useYou have to remove (or rename) that container 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 --namewithout cleanup - Compose project renamed, leaving old containers
⚡ Quick fix
- Remove it:
docker rm -f x - Use
docker run --rmfor one-off containers - Use Compose, which replaces containers on
up
Detailed fix by platform
Docker
- 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
- Existing —
docker ps -a --filter name=x - Script — Does it clean up before run?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- ACR unauthorized Azure Container Registry: unauthorized: authentication required, visit https://aka.ms/acr/authorization (AKS ErrImagePull 401)
- Container failed to start Cloud Run: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
- daemon Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Most viewed in Docker
- docker-credential-desktop error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH
- pull access denied pull access denied for image, repository does not exist or may require 'docker login'
- lookup registry-1.docker.io: no such host dial tcp: lookup registry-1.docker.io: no such host / Temporary failure in name resolution during docker build
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026