diff docker/libervia_cont.sh @ 112:a573bddf8039

docker (libervia_cont): put container used for maintenance in a variable
author Goffi <goffi@goffi.org>
date Mon, 29 Feb 2016 22:01:02 +0100
parents a3f9cfa2721e
children 885818d29012
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Mon Feb 29 21:54:43 2016 +0100
+++ b/docker/libervia_cont.sh	Mon Feb 29 22:01:02 2016 +0100
@@ -29,6 +29,7 @@
 
 CONTAINERS="prosody sat_pubsub salut sat libervia"
 TEST_CONT="libervia" # container used to test status
+MAINT_CONT="debian:jessie" # container used for maintenance
 
 DK_DETACH="-d"
 DK_TERM="-ti"
@@ -365,7 +366,7 @@
         SAT_CONT_BACKUP_DIR=$(echo $SAT_CONT_BACKUP_DIR | sed 's%^\/*\|\/*$%\/%g') # we want to be sure that path starts and finishes with "/"
         filename="sat_data_backup_$(date '+%Y-%m-%d_%H:%M:%S').tar.gz"
         printf "backing up data container to ${SAT_CONT_BACKUP_DIR}${filename}\n\n"
-        docker run --rm $DK_VOLUME -v "$SAT_CONT_BACKUP_DIR:/backup" debian:jessie tar zcvf "/backup/$filename" -C / -h volumes
+        docker run --rm $DK_VOLUME -v "$SAT_CONT_BACKUP_DIR:/backup" $MAINT_CONT tar zcvf "/backup/$filename" -C / -h volumes
         if [ $? -eq 0 ]; then
             printf "\nBackup finished and available at ${SAT_CONT_BACKUP_DIR}${filename}\n"
         else
@@ -393,7 +394,7 @@
             # workaround for a Docker bug (container crash if "." is used)
             HOST_BACKUP_DIR=$(pwd)
         fi
-        docker run --rm $DK_VOLUME -v "$HOST_BACKUP_DIR:/backup" debian:jessie tar zxvf "/backup/$HOST_BACKUP_NAME" -C / -h volumes
+        docker run --rm $DK_VOLUME -v "$HOST_BACKUP_DIR:/backup" $MAINT_CONT tar zxvf "/backup/$HOST_BACKUP_NAME" -C / -h volumes
         if [ $? -eq 0 ]; then
             printf "\nRestore finished\n"
         else
@@ -443,7 +444,7 @@
                 docker cp "$TMP_DIR/$HOST_CONF_FILE" "$VOLUME_ALIAS:$CONT_CONF_FILE"
             else
                 eprintf "Old Docker version detected, using workaround, please update!\n"
-                docker run --rm $DK_VOLUME -v "$TMP_DIR:/tmp_config" debian:jessie /bin/cp -f "/tmp_config/$HOST_CONF_FILE" "$CONT_CONF_FILE"
+                docker run --rm $DK_VOLUME -v "$TMP_DIR:/tmp_config" $MAINT_CONT /bin/cp -f "/tmp_config/$HOST_CONF_FILE" "$CONT_CONF_FILE"
             fi
         fi
         rm -rf "$TMP_DIR"