Blame view

remove_container.sh 805 Bytes
b1087939   hmalti   Ajout commandes
1
  #!/bin/bash
5721892d   hmalti   Avancées
2
  NAME_CONTAINER_TO_REMOVE=$1;
b1087939   hmalti   Ajout commandes
3
4
  
  #vérification que l'utilisateur donne bien un nom à l'CONTAINER
5721892d   hmalti   Avancées
5
6
  if [[ -z "$NAME_CONTAINER_TO_REMOVE" ]]; then 
    echo "Il faut donner le NAME du conteneur! Relancez la commande avec les bons arguments."
b1087939   hmalti   Ajout commandes
7
8
    exit
  fi
5721892d   hmalti   Avancées
9
10
  rm -rf $PATH_MANIFEST/containers/$NAME_CONTAINER_TO_REMOVE.manifest
  rm -rf $PATH_BALEINE/containers/$NAME_CONTAINER_TO_REMOVE
b1087939   hmalti   Ajout commandes
11
  
5721892d   hmalti   Avancées
12
13
14
15
16
17
  #umount /mnt/container
  umount /mnt/baleine/$NAME_CONTAINER_TO_REMOVE
  #supprime mnt/container
  rm -rf /mnt/baleine/$NAME_CONTAINER_TO_REMOVE
  #supprime l'image associé au container (manifest du container)
  rm -rf /var/lib/baleine/containers/$NAME_CONTAINER_TO_REMOVE
055618a3   hmalti   Ajout hash interf...
18
19
20
21
  
  #TODO : Supprimer interfaces réseaux
  #TODO : Grep manifeste container, récupère les interfaces
  #TODO : Boucle sur les interfaces, les supprime une à une