Commandes Linux : docker image rm

DOCKER IMAGE RM

Commande : docker image rm
Usage:	docker image rm [OPTIONS] IMAGE [IMAGE...]

Remove one or more images

Aliases:
  rm, rmi, remove

Options:
  -f, --force      Force removal of the image
      --no-prune   Do not delete untagged parents

 

Supprimer une image :

docker image rm [OPTIONS] image [image ...]

Forcer la suppression avec l’option -f.
Equivaut à :
docker rmi [OPTIONS] image [image ...]
ex :

$ docker image rm 5699ececb21c
Untagged: nginx:latest
Untagged: nginx@sha256:62a095e5da5f977b9f830adaf64d604c614024bf239d21068e4ca826d0d629a4
Deleted: sha256:5699ececb21caf07b92cbda9daa1e965407e3793a72000ecbf6b8e8595a0824a
Deleted: sha256:c34974813e70c230445629bfb7d58dfff99440d9e11fd8aa4230a50c6cb101f3
Deleted: sha256:85dd24921f1b33cd733671fbe604c4630899a19ef3a1822041f4b298636b79ca
Deleted: sha256:9c46f426bcb704beffafc951290ee7fe05efddbc7406500e7d0a3785538b8735

 

Supprimer toutes les images (taguées et non-taguées (dangling)) :

docker image rm $(docker image ls -q)

Equivaut à :
docker rmi $(docker image ls -q)
ex :

$ docker image rm $(docker image ls -q)
Untagged: debian:latest
Untagged: debian@sha256:6ee341d1cf3da8e6ea059f8bc3af9940613c4287205cd71d7c6f9e1718fdcb9b
Deleted: sha256:9a5d7185d3a6ede04c29cf89e4fa879f40e33324ced380decaf8919ffc5a4ade
Deleted: sha256:a2e66f6c6f5f248f2f8dcf31a3b569626ef61c6371e157fb0db857152983fc1d
Untagged: centos:latest
Untagged: centos@sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Deleted: sha256:49f7960eb7e4cb46f1a02c1f8174c6fac07ebf1eb6d8deffbcb5c695f1c9edd5
Deleted: sha256:bcc97fbfc9e1a709f0eb78c1da59caeb65f43dc32cd5deeb12b8c1784e5b8237
[...]

 

Supprimer uniquement les images non-taguées (dangling) :

docker image rm $(docker image ls --filter "dangling=true" -q)

ou

docker image prune

Equivaut à :
docker rmi $(docker images --filter "dangling=true" -q)
 

Supprimer toutes les images taguées et non-taguées (dangling) ainsi que les images intermédiaires :

docker image rm -f $(docker image ls -q)

Equivaut à :
docker rmi -f $(docker image ls -q)
 

Fermer le menu