Skip to content

Instantly share code, notes, and snippets.

@iamcaleberic
Last active February 12, 2018 18:41
Show Gist options
  • Save iamcaleberic/596d16d4330e649dceff52df0754c0cf to your computer and use it in GitHub Desktop.
Save iamcaleberic/596d16d4330e649dceff52df0754c0cf to your computer and use it in GitHub Desktop.
Docker deleting all containers and/or images

Docker deleting all containers and/or images

Warning: This will destroy all your images and containers. It will not be possible to restore them!

Deleting all containers

docker rm $(docker ps -a -q)

Deleting all images

docker rmi $(docker images -q)

script

  • Download script file below
  • Run chmod +x
  • Then Run bash rm.sh
  • Or ./rm.sh
#!/bin/bash
# Delete all containers
```docker rm $(docker ps -a -q)```
# Delete all images
```docker rmi $(docker images -q)```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment