mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-10-31 23:33:11 +01:00
Added draft for backup by volume instead of container
This commit is contained in:
parent
5f6e60d502
commit
c303a8b452
@ -1,9 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Just backups volumes of running containers
|
||||||
# If rsync stucks consider:
|
# If rsync stucks consider:
|
||||||
# @see https://stackoverflow.com/questions/20773118/rsync-suddenly-hanging-indefinitely-during-transfers
|
# @see https://stackoverflow.com/questions/20773118/rsync-suddenly-hanging-indefinitely-during-transfers
|
||||||
|
#
|
||||||
backup_time="$(date '+%Y%m%d%H%M%S')";
|
backup_time="$(date '+%Y%m%d%H%M%S')";
|
||||||
backups_folder="/Backups/";
|
backups_folder="/Backups/";
|
||||||
for docker_container_name in $(docker ps --format '{{.Names}}');
|
for volume_name in $(docker volume ls --format '{{.Name}}');
|
||||||
|
do
|
||||||
|
for docker_container_name in $(docker ps -a --filter volume=$volume_name --format '{{.Names}}');
|
||||||
do
|
do
|
||||||
echo "stop container: $docker_container_name" && docker stop "$docker_container_name"
|
echo "stop container: $docker_container_name" && docker stop "$docker_container_name"
|
||||||
for source_path in $(docker inspect --format '{{ range .Mounts }}{{ if eq .Type "volume" }}{{ println .Destination }}{{ end }}{{ end }}' "$docker_container_name");
|
for source_path in $(docker inspect --format '{{ range .Mounts }}{{ if eq .Type "volume" }}{{ println .Destination }}{{ end }}{{ end }}' "$docker_container_name");
|
||||||
@ -27,3 +31,4 @@ do
|
|||||||
done
|
done
|
||||||
echo "start container: $docker_container_name" && docker start "$docker_container_name";
|
echo "start container: $docker_container_name" && docker start "$docker_container_name";
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user