def METHOD_NAME(self) -> str:
    docker_host = os.environ.get("DOCKER_HOST", "").strip()
    if not docker_host or docker_host.startswith("unix://"):
        return "127.0.0.1"
    if match := re.match(r"^tcp://(.+?):\d+$", docker_host):
        return match[1]
    raise ValueError(f'Invalid value for DOCKER_HOST: "{docker_host}".')