創(chuàng)建并運行mysql容器執(zhí)行下面命令報錯
docker run -itd --name mysql -p 3306:3306 \
-v /opt/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=sq \
registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
報錯內容,提示‘容器名 “/mysql” 已由容器“32451f8994a2fbeb0ca292d8ac00fa58490e2be444794f21abbec12c3f9b69d6”使用。必須刪除(或重命名)該容器才能重用該名稱盯孙÷成’
docker: Error response from daemon: Conflict. The container name "/mysql" is already in use by container "32451f8994a2fbeb0ca292d8ac00fa58490e2be444794f21abbec12c3f9b69d6". You have to remove (or rename) that container to be able to reuse that name.
解決方案:
執(zhí)行 docker ps -a | grep mysql
就是找出現存哪個容器用了mysql名字,找到后執(zhí)行 docker rm 32451f8994a2
刪除振惰。然后再次執(zhí)行上面的創(chuàng)建并運行mysql容器命令就可以了歌溉。