Conflict. The container name "/web" is already in use by container "abc123"
Fixes 'Conflict. The container name is already in use' when starting a container with a duplicate --name. Use when a previous container (running or stopped) still holds the name. Not for port or network conflicts.
TL;DR: A container with that name already exists. Either remove the old one (docker rm web) or start the new one with a different --name. Stopped containers keep their names, which surprises people who thought docker stop freed it.
The error
Conflict. The container name "/web" is already in use by container "abc123def456". You have to remove (or rename) that container to be able to reuse that name.Fix it
- See the existing container:
docker ps -a --filter "name=web" Expected: the old container, running or exited.
- If you do not need it:
docker rm web Expected: no output.
- Or rename instead of deleting:
docker rename web web-old
- Re-run your original
docker run --name web ....
When this applies
- Re-running a
docker run --namecommand after the first container exited - Scripts that do not use
--rm
When this does NOT apply
- Port conflicts (different error, different fix)
- "is already in use by a network" style volume/network errors
Versions
All Docker versions.
Why it happens
Container names must be unique across all containers, including stopped ones. docker stop only stops the process; the container object (and its name) persists until docker rm.
Edge cases
- Add
--rmtodocker runin scripts and one-off commands so names free themselves on exit. - A container stuck in "Removal In Progress" holds the name; restart the daemon to clear it.
docker composemanages names itself; this error with compose usually means a stale project, fixed bydocker compose down.
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.