我在用 docker run 命令来在容器内运行一个应用程序,出现以下问题:

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

意思是:

来自守护进程的错误响应:冲突。容器名称“/mysql5719_1”为已在容器“c67e4f909eb001a321744f54b3b02143f1e9dd5ab3552b97d22f413e00a6f90b”中使用。您必须删除(或重命名)该容器才能重用该名称。

思路:

获取容器ID,删除对应容器。

1.获取容器ID

使用 docker ps 命令查看 Docker 进程:
You have to remove (or rename) that container to be able to reuse that name.

但是,由于这个进程没有正常启动,所以,此时没有显示出来。

因此,改用 docker ps -l 命令:
You have to remove (or rename) that container to be able to reuse that name.

参数解释:

  • -l 显示最新创建的容器(包含所有的状态)
    You have to remove (or rename) that container to be able to reuse that name.

2.删除对应容器

拿到了容器ID,现在可以执行 docker rm 指令了:
You have to remove (or rename) that container to be able to reuse that name.

OK, 问题解决!

参考文档

在Docker容器中运行程序时出错,You have to remove (or rename) that container to be able to reuse that name.
跳转 click here

相关文章: