How can I delete all local Docker images?
To delete all local Docker images, you can use the following command:
docker rmi $(docker images -q)
This command uses the docker rmi
command to remove all images, and docker images -q
to list all image IDs. The $(command)
syntax is used to run the docker images -q
command and pass its output as the argument to docker rmi
.
Alternatively, you can use the -f
option to force deletion of images that are in use by a container:
docker rmi -f $(docker images -q)
Please be careful when using this command as it will delete all local images.