admin avatar

docker停止並刪除容器的小問題

🕦 by admin





最近一直在折騰docker停止並刪除容器

但是每次可以把docker指定進程停止,但是無法刪除已經停止的容器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
docker container ls -a  //列出正在運行的進程
docker ps  //列出正在運行的進程
  NAMES                SIZE
a19328e56f90   wallabag/wallabag           "/entrypoint.sh wall…"   36 minutes ago   Up 36 minutes   0.0.0.0:800->80/tcp, :::800->80/tcp 
docker stop a19328e56f90  //停止該進程
docker rmi a19328e56f90 //嘗試刪除該容器,報錯
Error: No such image: a19328e56f90
docker rm $(docker ps -a -q)  //強制刪除所有停止的進程,還是報錯。
a19328e56f90
Error response from daemon: You cannot remove a running container 30cbbc0ae7ee2b361c015f20ab07715c9d398a156d97e0199f5c47c0ceecc9f4. Stop the container before attempting removal or force remove
docker images //列出所有鏡像文件
wallabag/wallabag           latest    633403335ede   10 days ago   805MB
docker rmi wallabag/wallabag  //刪除該鏡像文件,搞定
Untagged: wallabag/wallabag:latest
Untagged: wallabag/[email protected]:43d5362d72b1af4be87dbf808bf63add3fa6e487dd0149f7342b26a78c8a9bd3
Deleted: sha256:633403335ede5d8f5dd9a4c525d82ce4bbd41854cccecac0831e50e5f53f203d
Deleted: sha256:02140a4f8c516b73c7d9de8d51ba474d2007eb1c5e04d7430cff34d5280a0a29
Deleted: sha256:e34b889c3f11ac7b3f9c1bfd8106b70e1939d0970b09a7f22ea13862269d60e7
Deleted: sha256:559013fc391eee12aa692554ee3417f78bd8f6de7ae15d9e3142cc1e96dd8f0b
Deleted: sha256:a8e5fad9295a432884679c384de5b0fe218a54d46d768b016b9f260ee46f0909
Deleted: sha256:4fc242d58285699eca05db3cc7c7122a2b8e014d9481f323bd9277baacfa0628





💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.18.3 Processed in 1ms