I\'ve the following images:
alex@alexvps:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
&
Use
docker image prune -all
or
docker image prune -a
Remove all dangling images. If -a
is specified, it will also remove all images not referenced by any container.
Note: You are prompted for confirmation before the prune removes anything, but you are not shown a list of what will potentially be removed. In addition, docker image ls
does not support negative filtering, so it difficult to predict what images will actually be removed.
As stated under Docker's documentation for prune.
In order to delete all images, use the given command
docker rmi $(docker images -q)
In order to delete all containers, use the given command
docker rm $(docker ps -a -q)
Warning: This will destroy all your images and containers. It will not be possible to restore them!
This solution is provided by Techoverflow.net.
I found the answer in this command:
docker images --no-trunc | grep none | awk '{print $3}' | xargs docker rmi
I had your problem when I deleted some images that were being used, and I didn't realise (using docker ps -a
).
First, remove all the containers using the following command
sudo docker ps -a -q | xargs -n 1 -I {} sudo docker rm {}
Then, remove the image by its ID using the following command
sudo docker rmi <image-id>
I have found a solution with Powershell script that will do it for me.
The script at first stop all containers than remove all containers and then remove images that are named by the user.
Look here http://www.devcode4.com/article/powershell-remove-docker-containers-and-images