Delete all images but ignore a few of the images, use this:
docker rmi $(docker images -a -q | grep -v 'image_id')