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.
- docker stop $(docker ps -q)
- docker rm $(docker ps -aa)
- docker rmi $(docker images -q)
- systemctl stop docker
- systemctl start docker
- docker-compose up
Feedback on how community is tackling this issue is welcome!