From 1e8131d2b0cc907236e047590b085eedd45ea050 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Tue, 3 Dec 2019 04:21:27 +0100 Subject: [PATCH] Bug: specify network mode for backup process container --- restic_volume_backup/backup_runner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/restic_volume_backup/backup_runner.py b/restic_volume_backup/backup_runner.py index 684627e..56726a0 100644 --- a/restic_volume_backup/backup_runner.py +++ b/restic_volume_backup/backup_runner.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) def run(image: str = None, command: str = None, volumes: dict = None, - environment: dict = None, labels: dict = None): + environment: dict = None, labels: dict = None, source_container_id: str = None): logger.info("Starting backup container") config = Config() client = docker.DockerClient(base_url=config.docker_base_url) @@ -17,10 +17,11 @@ def run(image: str = None, command: str = None, volumes: dict = None, image, command, labels=labels, - # auto_remove=True, + # auto_remove=True, # We remove the container further down detach=True, environment=environment, volumes=volumes, + network_mode=f'container:{source_container_id}', # Reuse original container's network stack. working_dir=os.getcwd(), tty=True, )