Error response from daemon: Conflict. The container name "/mysql" is already in use by container

执行:
docker run --name mysql -p 3306:3306 -v /root/bo/data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -it wzj/mysql


docker: Error response from daemon: Conflict. The container name "/mysql" is already in use by container "3131fbf478c984cf393b65dde14342af4e3331f9f5641a4821b426cdca20abba". You have to remove (or rename) that container to be able to reuse that name.

解决办法:
查看 docker ps -a
docker ps -a

看到之前运行docker容器还没有退出,导致出现容器重名情况。

使用下面命令,删除容器,

docker rm fb087642b497(镜像ID) 
docker rm 7b739cc26085

执行:
docker restart nginx
重启即可

你可能感兴趣的:(容器,Docker)