How to wait for pg_isready

It appears that there is no reliable way to run a shell command within the docker instance, other than using timeouts?

I'd like to implement WaitFor strategy such that the port is fully available to use, like

  #[derive(Clone)]
  struct PgIsReady();

  #[async_trait]
  impl WaitFor for PgIsReady {
    async fn wait_for_ready(&self, container: PendingContainer) -> Result<RunningContainer, DockerTestError> {
      // container
      todo!()
    }
  }

but none of fields are public for PendingContainer. Any ideas?