1.停止所有的container,這樣才能夠刪除其中的images:
docker stop $(docker ps -a -q)
如果想要刪除所有container的話再加乙個指令:
docker rm $(docker ps -a -q)
2.檢視當前有些什麼images
docker images
3.刪除images,通過image的id來指定刪除誰
docker rmi
想要刪除untagged images,也就是那些id為的image的話可以用
docker rmi $(docker images | grep "^" | awk "")
要刪除全部image的話
docker rmi $(docker images -q)
(1)啟動,systemctl start docker.service
(2)開機啟動,systemctl enable docker.service
(3)幫助,docker --help
(4)概要資訊,docker info
(5)映象檢視,docker images
(6)容器檢視,即程序檢視,docker ps -a
(7)最近容器檢視, docker ps -l
(1)docker ps -a 可以顯示容器id
(2)docker stop 8dc6a2b6f903 停止容器
(3)docker rm 8dc6a2b6f903 刪除容器
(4)docker ps 顯示當前正在執行的容器
docker commit 235923e34a nginx/centos 將自己構建好的235923e34a容器提交到本地當作下次可以再次使用的映像
docker run --name=nexus -i -t centos /bin/bash
docker inspect nexus
docker start -i nexus 重新啟動已經停止的容器
docker run --name=nexus -i -t centos /bin/bash ctrl + p ctrl + q 退出互動式,以後臺服務執行
docker attach nexus 可把後台執行服務提公升到互動式執行
docker run --name=nexus -d centos /bin/sh -c "while true; do echo 'hello world'; sleep 1; done"
docker logs -t -f --tail 10 nexus 顯示nexus容器列印的最新10條日誌,指定10為0時,顯示所有日誌
docker top nexus 檢視nexus程序運**況
docker exec -i -t nexus /bin/bash 在已經啟動的nexus容器中加入新的程序bash,ctrl + p ctrl + q 退出互動式,以後臺服務執行,利用docker top nexus命令可以檢視程序
docker stop nexus 傳送乙個停止訊號,優雅停止容器
docker kill nexus 直接停止容器
docker network ls 檢視容器建立的網路
docker attach 容器id 和 docker exec -it 容器id 都可以將容器提公升到前台。但是attach方法,當在容器中exit時,容器會退出,即使是啟動時候指定是後台啟動;而exec方法,在視窗中exit時,僅僅是退出當前操作終端,而不會退出程序。
這僅僅是docker的常用操作命令,要深入學習還要多看官方文件,多學linux系統操作。
推薦《第一本docker書》作為入門。
今天建立docker容器的時候由於疏忽,映象的名字輸錯了,結果容器建立成功後,映象**現兩個id相同的:
使用docker rmi e4a35914679d刪除的時候執行失敗:
error response from daemon: conflict: unable to delete e4a35914679d (must be forced) - image is referenced in one or more repositories
提示應該是該id有兩個本地檔案,不能用id刪除。
所以我想刪除所有映象docker rmi $(docker images -q),出現下面錯誤
error response from daemon: conflict: unable to delete e4a35914679d (must be forced) - image is referenced in one or more repositories
後來在stack overflow刪看到使用repository和tag進行操作的,所以執行docker rmi docker.io/redis:3.2
再次查詢的時候只剩下乙個映象,刪除ok。
所以,可以使用repository:tag的組合來刪除特殊的映象。
Docker 容器映象刪除
1.停止所有的container,這樣才能夠刪除其中的images docker stop docker ps a q 如果想要刪除所有container的話再加乙個指令 docker rm docker ps a q 2.檢視當前有些什麼images docker images 3.刪除image...
Docker 容器映象刪除
1.停止所有的container,這樣才能夠刪除其中的images docker stop docker ps a q 如果想要刪除所有container的話再加乙個指令 docker rm docker ps a q 2.檢視當前有些什麼images docker images 3.刪除image...
Docker 容器映象刪除
1.停止所有的container,這樣才能夠刪除其中的images docker stop docker ps a q 如果想要刪除所有container的話再加乙個指令 docker rm docker ps a q 2.檢視當前有些什麼images docker images 3.刪除image...