Home › Docker

Conflict. The container name is already in use by container — how to fix

docker: Error response from daemon: Conflict. The container name "/web" is already in use by container "3f5c1e…". You have to remove (or rename) that container to be able to reuse that name.

Quick fix: Remove the old one: docker rm -f web, then run again. Or reuse it: docker start web. Add --rm to docker run so containers delete themselves when they stop.

What it means

docker run --name web ... creates a new container. Container names are unique, and a container named web already exists, even if it's stopped.

docker ps -a --filter name=web

Fix 1: remove the old container

docker rm web        # if it's stopped
docker rm -f web     # stop and remove

Volumes survive this; anonymous data inside the container's filesystem does not.

Fix 2: start the existing container

If you want the same container (with its existing state) back:

docker start -a web

Fix 3: avoid it in the future

docker run --rm --name web nginx       # removed automatically when it stops

In scripts, remove before running:

docker rm -f web 2>/dev/null || true
docker run -d --name web nginx

Or use Docker Compose, which recreates containers for you with docker compose up -d.

Last updated 2026-10-27.