remove dangling images docker code example
Example 1: docker stop all
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Example 2: remove all images docker
docker rmi $(docker images -a -q)
Example 3: how to delete dangling docker images
sudo docker rmi $(sudo docker images -f "dangling=true" -q)
Example 4: how to delete dangling docker images
sudo sh -c 'docker rmi $(docker images -f "dangling=true" -q)'
Example 5: docker remove dangling images
docker image prune
Example 6: delete container id
docker rm $(docker ps -a -q)