-
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
- Delete all untagged images
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
| #!/usr/bin/env bash | |
| func_check_for_root() { | |
| if [ ! $( id -u ) -eq 0 ]; then | |
| echo "ERROR: $0 Must be run as root, Script terminating" ;exit 7 | |
| fi | |
| } | |
| func_check_for_root | |
| #SETUP PARAMS |