blob: 8635eab0d600dc70b31dd3ce062e00928ad9fce0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/bash
# Stop any running containers
running_container_ids=`docker ps -q`
if test -n "$running_container_ids"
then
docker stop $running_container_ids
fi
# Delete all containers
container_ids=`docker ps -a -q`
if test -n "$container_ids"
then
docker rm -f -v $container_ids
fi
# Delete all images (forcefully)
image_ids=`docker images -aq`
if test -n "$image_ids"
then
# Some layers are deleted recursively and are no longer present
# when docker goes to remove them:
docker rmi -f `docker images -aq` || true
fi
|