問題:剛開始使用如下命令,均無法進行刪除:如 docker rmi 鏡像id
[root@localhost sha256]# docker rmi 5acf0e8da90b
Error: No such image: 5acf0e8da90b
[root@localhost containers]# docker rmi $(docker images -q)
Error: No such image: f9b990972689
Error: No such image: a7a67c95e831
Error: No such image: 0ce6496aae74
Error: No such image: 5acf0e8da90b
[root@localhost containers]# docker stop $(docker ps -a -q)
"docker stop" requires at least 1 argument.
See 'docker stop --help'.
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
Stop one or more running containers
[root@localhost containers]#
[root@localhost containers]# docker rmi $(docker images -q)
Error: No such image: f9b990972689
Error: No such image: a7a67c95e831
Error: No such image: 0ce6496aae74
Error: No such image: 5acf0e8da90b
[root@localhost containers]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest f9b990972689 5 days ago 104MB
mysql latest a7a67c95e831 9 days ago 541MB
openjdk latest 0ce6496aae74 3 weeks ago 497MB
elasticsearch latest 5acf0e8da90b 19 months ago 486MB
[root@localhost containers]# docker rmi elasticsearch:latest
Error: No such image: elasticsearch:latest
[root@localhost containers]# clear
解決:這裏我是刪除了所有鏡像
[root@localhost containers]# cd /var/lib/docker
[root@localhost docker]# ls
builder containers network plugins swarm trust
buildkit image overlay2 runtimes tmp volumes
[root@localhost docker]# cd image/
[root@localhost image]# ll
總用量 0
drwx------. 5 root root 81 5月 8 08:55 overlay2
[root@localhost image]# cd overlay2/
[root@localhost overlay2]# ll
總用量 4
drwx------. 4 root root 58 5月 4 15:40 distribution
drwx------. 4 root root 37 5月 4 15:39 imagedb
drwx------. 5 root root 45 5月 4 15:41 layerdb
-rw-------. 1 root root 1180 5月 8 08:55 repositories.json
[root@localhost overlay2]# cd imagedb/
[root@localhost imagedb]# ll
總用量 0
drwx------. 3 root root 20 5月 4 15:39 content
drwx------. 3 root root 20 5月 4 15:39 metadata
[root@localhost imagedb]# cd content/sha256/
[root@localhost sha256]# ll
總用量 36
-rw-------. 1 root root 4594 5月 4 15:50 0ce6496aae7402e2a40a9588c478edfe51f1696492be811c405992d4d8163dec
-rw-------. 1 root root 9573 5月 7 23:55 5acf0e8da90b995bace9fdc8f12c02ba323441873a509c19258ce0afa6754d0b
-rw-------. 1 root root 7116 5月 4 15:44 a7a67c95e83189d60dd24cfeb13d9f235a95a7afd7749a7d09845f303fab239c
-rw-------. 1 root root 6927 5月 4 15:40 f9b9909726890b00d2098081642edf32e5211b7ab53563929a47f250bcdc1d7c
-rw-------. 1 root root 6927 5月 4 15:40 5acf0e8da90b995bace9fdc8f12c02ba323441873a509c19258ce0afa6754d0b
[root@localhost sha256]# rm *
rm:是否刪除普通文件 "0ce6496aae7402e2a40a9588c478edfe51f1696492be811c405992d4d8163dec"?y
rm:是否刪除普通文件 "5acf0e8da90b995bace9fdc8f12c02ba323441873a509c19258ce0afa6754d0b"?
rm:是否刪除普通文件 "a7a67c95e83189d60dd24cfeb13d9f235a95a7afd7749a7d09845f303fab239c"?y
rm:是否刪除普通文件 "f9b9909726890b00d2098081642edf32e5211b7ab53563929a47f250bcdc1d7c"?y
rm:是否刪除普通文件 "5acf0e8da90b995bace9fdc8f12c02ba323441873a509c19258ce0afa6754d0b"?y
[root@localhost sha256]# systemctl restart docker
[root@localhost sha256]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@localhost sha256]#