Skip to content

Instantly share code, notes, and snippets.

@packmad
Last active February 23, 2024 10:44
Show Gist options
  • Save packmad/167e59d85497be84500f568da4f921f1 to your computer and use it in GitHub Desktop.
Save packmad/167e59d85497be84500f568da4f921f1 to your computer and use it in GitHub Desktop.
Remove all docker images one liner
# enter in the bash of the first container
docker exec -it $(docker ps | head -n 2 | tail -n 1 | cut -d " " -f 1) bash
# delete all containers
docker ps -a | tail -n +2 | cut -d " " -f 1 | xargs docker rm
# delete all images
docker images | tail -n +2 | tr -s " " | cut -d " " -f 3 | xargs docker rmi -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment