diff --git a/dangerzone/container.py b/dangerzone/container.py index 930de7a..cd7eb8d 100644 --- a/dangerzone/container.py +++ b/dangerzone/container.py @@ -52,11 +52,17 @@ def exec(args, stdout_callback=None): def exec_container(command, extra_args=[], stdout_callback=None): if container_tech == "podman": container_runtime = shutil.which("podman") + if container_runtime is None: + raise Exception(f"podman is not installed") + platform_args = [] security_args = ["--security-opt", "no-new-privileges"] security_args += ["--userns", "keep-id"] else: container_runtime = shutil.which("docker") + if container_runtime is None: + raise Exception(f"docker is not installed") + platform_args = ["--platform", "linux/amd64"] security_args = ["--security-opt=no-new-privileges:true"] diff --git a/dangerzone/global_common.py b/dangerzone/global_common.py index 35f4da9..a979ff9 100644 --- a/dangerzone/global_common.py +++ b/dangerzone/global_common.py @@ -386,11 +386,15 @@ class GlobalCommon(object): ) print(Back.BLACK + Fore.YELLOW + Style.DIM + "╰──────────────────────────╯") - def get_container_runtime(self): + def get_container_runtime(self) -> str: if platform.system() == "Linux": - return shutil.which("podman") + runtime_name = "podman" else: - return shutil.which("docker") + runtime_name = "docker" + runtime = shutil.which(runtime_name) + if runtime is None: + raise Exception(f"{runtime_name} is not installed") + return runtime def get_resource_path(self, filename: str) -> str: if getattr(sys, "dangerzone_dev", False):