Blame view

delete_hetzner.sh 478 Bytes
13cf4fd7b   George Vlahavas   Add hetzner_delet...
1
2
  #!/bin/bash
  # Stop containers and removes containers, networks, volumes, and images 
86740f6d3   George Vlahavas   Delete volumes wh...
3
  docker-compose -f docker-compose-hetzner.yml down --volumes
13cf4fd7b   George Vlahavas   Add hetzner_delet...
4
5
6
7
  docker volume ls | \
  	grep kea_ | \
  	tr -s ' ' | \
  	cut -d' ' -f2 | \
a88603582   George Vlahavas   Force volume dele...
8
  	xargs docker volume rm -f
13cf4fd7b   George Vlahavas   Add hetzner_delet...
9
10
11
12
13
14
15
16
17
18
19
  
  # Wait a bit 
  sleep 5s
  
  # Check that containers were removed succesfully
  res=`docker ps -a | grep "/curex-local/kea_" | wc -l`
  if [ $res -ne 0 ]; then
  	echo "ERROR: Some KEA containers have not been removed."
  	docker ps -a
  	exit 1
  fi