Bug: specify network mode for backup process container

This commit is contained in:
Einar Forselv 2019-12-03 04:21:27 +01:00
parent ff06c5c90f
commit 1e8131d2b0
1 changed files with 3 additions and 2 deletions

View File

@ -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,
)