diff --git a/exegol/model/ExegolContainerTemplate.py b/exegol/model/ExegolContainerTemplate.py index cb7ca608..cd950d91 100644 --- a/exegol/model/ExegolContainerTemplate.py +++ b/exegol/model/ExegolContainerTemplate.py @@ -3,6 +3,7 @@ from rich.prompt import Prompt +from exegol.config.EnvInfo import EnvInfo from exegol.model.ContainerConfig import ContainerConfig from exegol.model.ExegolImage import ExegolImage @@ -14,6 +15,9 @@ def __init__(self, name: Optional[str], config: ContainerConfig, image: ExegolIm if name is None: name = Prompt.ask("[bold blue][?][/bold blue] Enter the name of your new exegol container", default="default") assert name is not None + if EnvInfo.isWindowsHost() or EnvInfo.isMacHost(): + # Force container as lowercase because the filesystem of windows / mac are case-insensitive => https://github.com/ThePorgs/Exegol/issues/167 + name = name.lower() self.container_name: str = name if name.startswith("exegol-") else f'exegol-{name}' self.name: str = name.replace('exegol-', '') if hostname: diff --git a/exegol/utils/DockerUtils.py b/exegol/utils/DockerUtils.py index 2417f3ca..72660c14 100644 --- a/exegol/utils/DockerUtils.py +++ b/exegol/utils/DockerUtils.py @@ -154,6 +154,13 @@ def getContainer(cls, tag: str) -> ExegolContainer: return # type: ignore # Check if there is at least 1 result. If no container was found, raise ObjectNotFound. if container is None or len(container) == 0: + # Handle case-insensitive OS + if EnvInfo.isWindowsHost() or EnvInfo.isMacHost(): + # First try to fetch the container as-is (for retroactive support with old container with uppercase characters) + # If the user's input didn't match any container, try to force the name in lowercase if not already tried + lowered_tag = tag.lower() + if lowered_tag != tag: + return cls.getContainer(lowered_tag) raise ObjectNotFound # Filter results with exact name matching for c in container: