def wait_container_is_ready(*transient_exceptions) -> Callable:
    """
    Wait until container is ready.

    Function that spawn container should be decorated by this method Max wait is configured by
    config. Default is 120 sec. Polling interval is 1 sec.

    Args:
        *transient_exceptions: Additional transient exceptions that should be retried if raised. Any
            non-transient exceptions are fatal, and the exception is re-raised immediately.
    """
    transient_exceptions = TRANSIENT_EXCEPTIONS + tuple(transient_exceptions)

    @wrapt.decorator
    def wrapper(wrapped: Callable, instance: Any, args: list, kwargs: dict) -> Any:
        from testcontainers.core.container import DockerContainer

        if isinstance(instance, DockerContainer):
            logger.info("Waiting for container %s with image %s to be ready ...", instance._container, instance.image)
        else:
            logger.info("Waiting for %s to be ready ...", instance)

        exception = None
        for attempt_no in range(config.max_tries):
            try:
                return wrapped(*args, **kwargs)
            except transient_exceptions as e:
                logger.debug(
                    f"Connection attempt '{attempt_no + 1}' of '{config.max_tries + 1}' "
                    f"failed: {traceback.format_exc()}"
                )
                time.sleep(config.sleep_time)
                exception = e
        raise TimeoutError(
            f"Wait time ({config.timeout}s) exceeded for {wrapped.__name__}(args: {args}, kwargs: "
            f"{kwargs}). Exception: {exception}"
        )

    return wrapper

    Wait until container is ready.

    Function that spawn container should be decorated by this method Max wait is configured by
    config. Default is 120 sec. Polling interval is 1 sec.

    Args:
        *transient_exceptions: Additional transient exceptions that should be retried if raised. Any
            non-transient exceptions are fatal, and the exception is re-raised immediately.
    
core/testcontainers/core/waiting_utils.py