mirror of
				https://github.com/kevinveenbirkenbach/docker-volume-backup.git
				synced 2025-11-04 10:38:00 +00:00 
			
		
		
		
	Solved bug concerning non running containers
This commit is contained in:
		@@ -15,6 +15,10 @@ do
 | 
			
		||||
  containers="$(docker ps --filter volume="$volume_name" --format '{{.Names}}')";
 | 
			
		||||
  containers_array=($containers)
 | 
			
		||||
  container=${containers_array[0]}
 | 
			
		||||
  if [ -z "$containers" ]
 | 
			
		||||
    then
 | 
			
		||||
      echo "skipped due to no running containers using this volume."
 | 
			
		||||
    else
 | 
			
		||||
      echo "stop containers:" && docker stop $containers
 | 
			
		||||
      for source_path in $(docker inspect --format "{{ range .Mounts }}{{ if eq .Type \"volume\"}}{{ if eq .Name \"$volume_name\"}}{{ println .Destination }}{{ end }}{{ end }}{{ end }}" "$container");
 | 
			
		||||
      do
 | 
			
		||||
@@ -39,5 +43,6 @@ do
 | 
			
		||||
        rsync -abP --delete --delete-excluded --log-file=$log_path --backup-dir=$raw_backup_dir_path '$source_path/' $raw_destination_path";
 | 
			
		||||
        echo "start containers:" && docker start $reverse_containers;
 | 
			
		||||
      done
 | 
			
		||||
  fi
 | 
			
		||||
  echo "end backup routine: $volume_name";
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user