Running the docker
registry with below command always throws an error:
dev:tmp me$ docker run \\
-d --name registry-v1 \\
-e SETTINGS_
Cause
A container with the same name is still existing.
Solution
To reuse the same container name, delete the existing container by:
docker rm <container name>
Explanation
Containers can exist in following states, during which the container name can't be used for another container:
created
restarting
running
paused
exited
dead
You can see containers in running
state by using :
docker ps
To show containers in all states and find out if a container name is taken, use:
docker ps -a
I was running into this issue that when I run docker rm
(which usually works) I would get:
Error: No such image
The easiest solution to this is removing all stopped containers by running:
docker container prune
removing all the exited containers
docker rm $(docker ps -a -f status=exited -q)
I got confused by this also. There are two commands relevant here:
docker run Run a command in a new container
docker start Start one or more stopped containers
I have solved the issue by doing following steps and I hope it helps.
docker ps -a
to list all the containers in your system. docker rm --force name_of_container
I had problem using NIFI and I have removed and reinstalled using docker. Good luck.
I'm just learning docker and this got me as well. I stopped the container with that name already and therefore I thought I could run a new container with that name.
Not the case. Just because the container is stopped, doesn't mean it can't be started again, and it keeps all the same parameters that it was created with (including the name).
when I ran docker ps -a
that's when I saw all the dummy test containers I created while I was playing around.
No problem, since I don't want those any more I just did docker rm containername
at which point my new container was allowed to run with the old name.
Ah, and now that I finish writing this answer, I see Slawosz's comment on Walt Howard's answer above suggesting the use of docker ps -a