docker restart container failed: “already in use”, but there's no more docker image

前端 未结 3 1021
长情又很酷
长情又很酷 2021-01-31 15:03

I first got my nginx docker image:

docker pull nginx

Then I started it:

docker run -d -p 80:80 --name webserver nginx
         


        
3条回答
  •  没有蜡笔的小新
    2021-01-31 15:33

    As the error says.

    You have to remove (or rename) that container to be able to reuse that name

    This leaves you two options.

    • You may delete the container that is using the name "webserver" using the command

      docker rm 036a0bcd196c5b23431dcd9876cac62082063bf62a492145dd8a55141f4dfd74

    and retry.

    • Or you may use a different name during the run command. This is not recommended, as you no longer need that docker.

    It's better to remove the unwanted docker and reuse the name.

提交回复
热议问题