docker error - 'name is already in use by container'

后端 未结 18 2112
暖寄归人
暖寄归人 2020-12-12 08:14

Running the docker registry with below command always throws an error:

dev:tmp me$ docker run \\
     -d --name registry-v1 \\
     -e SETTINGS_         


        
18条回答
  •  旧时难觅i
    2020-12-12 09:01

    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

提交回复
热议问题