mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-22 08:21:04 +01:00
Compare commits
2 Commits
7702b17a9d
...
d537393da8
Author | SHA1 | Date | |
---|---|---|---|
d537393da8 | |||
2b716e5d90 |
@ -142,7 +142,7 @@ def get_last_backup_dir(volume_name, current_backup_dir):
|
||||
return None
|
||||
|
||||
def getStoragePath(volume_name):
|
||||
return execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}")
|
||||
return execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}")[0]
|
||||
|
||||
def backup_volume(volume_name, volume_dir):
|
||||
"""Backup files of a volume with incremental backups."""
|
||||
@ -165,18 +165,18 @@ def has_image(container,image):
|
||||
"""Check if the container is using the image"""
|
||||
image_info = get_image_info(container)
|
||||
return image in image_info[0]
|
||||
|
||||
|
||||
def stop_containers(containers):
|
||||
"""Stop a list of containers."""
|
||||
for container in containers:
|
||||
print(f"Stopping container {container}...")
|
||||
execute_shell_command(f"docker stop {container}")
|
||||
|
||||
container_list = ' '.join(containers)
|
||||
print(f"Stopping containers {container_list}...")
|
||||
execute_shell_command(f"docker stop {container_list}")
|
||||
|
||||
def start_containers(containers):
|
||||
"""Start a list of stopped containers."""
|
||||
for container in containers:
|
||||
print(f"Starting container {container}...")
|
||||
execute_shell_command(f"docker start {container}")
|
||||
"""Start a list of containers."""
|
||||
container_list = ' '.join(containers)
|
||||
print(f"Start containers {container_list}...")
|
||||
execute_shell_command(f"docker start {container_list}")
|
||||
|
||||
def get_container_with_image(containers,image):
|
||||
for container in containers:
|
||||
|
Loading…
Reference in New Issue
Block a user