Upgrade to recent docker client
This commit is contained in:
parent
197cc16b01
commit
7a647c06b7
|
@ -4,12 +4,13 @@ import docker
|
|||
from restic_volume_backup.config import Config
|
||||
|
||||
def run():
|
||||
client = docker.Client(base_url=DOCKER_BASE_URL)
|
||||
config = Config()
|
||||
client = docker.DockerClient(base_url=config.docker_base_url)
|
||||
|
||||
container = client.containers.run(
|
||||
'image',
|
||||
'command',
|
||||
labels={"restic-volume-backup.backup_process": True},
|
||||
'restic-volume-backup_backup',
|
||||
'echo "Hello"',
|
||||
labels={"restic-volume-backup.backup_process": 'True'},
|
||||
auto_remove=True,
|
||||
remove=True,
|
||||
detach=True,
|
||||
|
|
|
@ -3,6 +3,8 @@ import sys
|
|||
|
||||
from restic_volume_backup.config import Config
|
||||
from restic_volume_backup.containers import RunningContainers
|
||||
from restic_volume_backup import backup_runner
|
||||
from restic_volume_backup import restic
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -22,17 +24,15 @@ def main():
|
|||
|
||||
print()
|
||||
|
||||
elif args.mode == 'backup':
|
||||
elif args.action == 'backup':
|
||||
print("Starting backup ..")
|
||||
# TODO: Errors when repo already exists
|
||||
# restic.init_repo(Config.repository)
|
||||
restic.init_repo(config.repository)
|
||||
|
||||
backup_runner.run()
|
||||
# for vol in containers.backup_volumes():
|
||||
# restic.backup_volume(Config.repository, vol)
|
||||
|
||||
elif args.mode == 'snapshots':
|
||||
restic.snapshots(config.repository)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(prog='restic_volume_backup')
|
||||
|
|
|
@ -6,7 +6,7 @@ from restic_volume_backup.config import Config
|
|||
def list_containers():
|
||||
"""Easily mockable container list"""
|
||||
config = Config()
|
||||
client = docker.Client(base_url=config.docker_base_url)
|
||||
client = docker.APIClient(base_url=config.docker_base_url)
|
||||
all_containers = client.containers()
|
||||
client.close()
|
||||
return all_containers
|
||||
|
|
Loading…
Reference in New Issue