docker delet image code example

Example 1: windows delete all docker images

$ docker system prune --all

Example 2: remove docker images

docker system prune -a

Example 3: docker delete container and image

# remove containers created between now upto 4hrs back
docker container prune --filter "until=4h"

# remove images created between now upto 4hrs back
docker image prune --filter "until=4h"

Example 4: remove all docker images

$images = docker images -a -q
foreach ($image in $images) { docker image rm $image -f }

Example 5: remove image docker

# If image from a private repo
docker image rm [OPTIONS] myuser/myrepo:myimage

[OPTIONS]
--force

Tags:

Misc Example