Docker Community Forums

Share and learn in the Docker community.

Dangling container name problem - name ... already in use by container

docker

(Dockerforum) #1

docker-engine: 1.11.2
docker-compose: 1.8.0

Summary: As part of everyday code deploy, we started seeing the ‘Conflict. The name “/container-A” is already in use by container 121ksdlfksdf. You have to remove (or rename) that container to be able to reuse that name.’ error.

“docker ps -a” did not show the container-A. “grep -r -e ‘container-ID/Name’ /var/lib/docker/” did not show any match in the filesystem.

Fix: Whenever this happens (2 episodes so far), we take the following actions to fix the issue. Note that, if we do not stop and start (line 4,5), the issue persists. Maybe this is a memory related issue in version 1.11.2.

  1. docker stop $(docker ps -q)
  2. docker rm $(docker ps -aa)
  3. docker rmi $(docker images -q)
  4. systemctl stop docker
  5. systemctl start docker
  6. docker-compose up

Feedback on how community is tackling this issue is welcome!
Thanks


(Aaron Tribou) #2

I also encountered this issue when attempting to deploy a simple web app to Docker Cloud using dockercloud/haproxy as a proxy container. Unfortunately, I didn’t see this thread to try the suggested steps to fix.

update:
Appears to only be happening when using Docker Cloud with with a “bring your own node” installation on CentOS.


(Dvohra) #3

Dangling images could be removed with
sudo docker rmi $(sudo docker images -f "dangling=true" -q)


(Pieter) #4

We experience the same problem on Docker 1.10.3.

We can reproduce this running:
while true; do name=test1; docker run -d --name $name --net test nginx; docker stop $name; docker rm -f $name; done

Letting this run for a couple of minutes often results in: The name “/test1” is already in use by container 5ad7ea21bbff935e4d137f0887784868128dbf179b26a0421a8b4abd960fc17d


(Mbrevda) #5

I seem to be having the same issues. Have you found a solution for it?