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

 

使用docker 出現Error response from daemon: Conflict. The container name 「***」 is already in use
解決方法:
(1)給容器換一個名字, 好比說 docker run -it --name=mycentos2 centos:7 /bin/bash, 能夠解決問題.
(2)將原來的容器刪除


java

查詢當前容器:docker container ls -allmysql

刪除當前容器:docker container rm mycentos(提示: 這一步要肯定刪除容器沒問題的狀況下, 才能夠作)sql

 

這裏有兩個不一樣的單詞,images和container。其中images很好理解,跟日常使用的虛擬機的鏡像一個意思,至關於一個模版,而container則是images運行時的的狀態。docker對於運行過的image都保留一個狀態(container),能夠使用命令docker ps來查看正在運行的container,對於已經退出的container,則能夠使用docker ps -a來查看。 若是你退出了一個container而忘記保存其中的數據,你能夠使用docker ps -a來找到對應的運行過的container使用docker commit命令將其保存爲image而後運行。docker

回到以前的問題,因爲image被某個container引用(拿來運行),若是不將這個引用的container銷燬(刪除),那image確定是不能被刪除。centos

因此想要刪除運行過的images必須首先刪除它的container。
———————————————— 
bash

 

針對上面報錯也能夠:spa

docker: Error response from daemon: Conflict. The container name 「/mysql」 is already in use by container 「27e9834dce87b6cac674945d7917ce2f9c52537569420275fd05b3e5e6460070」. You have to remove (or rename) that container to be able to reuse that name.
出現上述的錯誤,是由於docker容器裏面已經存在,若是不須要,則刪除。docker rm fb087642b497(該containerID)
若是想要再次使用,使用

.net

docker restart 鏡像名
1
則能夠重啓該container容器。
———————————————— 


rest

 

http://www.javashuo.com/article/p-qwuvjruf-nb.htmlblog

https://blog.csdn.net/liuyinfei_java/article/details/88634469

相關文章
相關標籤/搜索