From 9efa4d5ab3eef2d6877f524c1f6049c6027edb63 Mon Sep 17 00:00:00 2001 From: czoido Date: Thu, 26 Sep 2024 16:49:26 +0200 Subject: [PATCH] add network --- conan/internal/runner/docker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conan/internal/runner/docker.py b/conan/internal/runner/docker.py index b9f9ab8f1e4..eee5e955146 100644 --- a/conan/internal/runner/docker.py +++ b/conan/internal/runner/docker.py @@ -15,7 +15,7 @@ def config_parser(file_path): Build = namedtuple('Build', ['dockerfile', 'build_context', 'build_args', 'cache_from']) - Run = namedtuple('Run', ['name', 'environment', 'user', 'privileged', 'cap_add', 'security_opt', 'volumes']) + Run = namedtuple('Run', ['name', 'environment', 'user', 'privileged', 'cap_add', 'security_opt', 'volumes', 'network']) Conf = namedtuple('Conf', ['image', 'build', 'run']) if file_path: def _instans_or_error(value, obj): @@ -40,6 +40,7 @@ def _instans_or_error(value, obj): cap_add=_instans_or_error(runnerfile.get('run', {}).get('capAdd'), list), security_opt=_instans_or_error(runnerfile.get('run', {}).get('securityOpt'), list), volumes=_instans_or_error(runnerfile.get('run', {}).get('mounts'), dict), + network=_instans_or_error(runnerfile.get('run', {}).get('network'), str), ) ) else: @@ -145,7 +146,8 @@ def run(self): cap_add=self.configfile.run.cap_add, security_opt=self.configfile.run.security_opt, detach=True, - auto_remove=False) + auto_remove=False, + network=self.configfile.run.network) _docker_info(f'Container {self.name} running') except Exception as e: raise ConanException(f'Imposible to run the container "{self.name}" with image "{self.image}"'