code: def run_vllm_docker(inf_port, base_model, tokenizer=None):
      if base_model == "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v2":
          # 7b has 71 heads, not divisible
          os.environ["CUDA_VISIBLE_DEVICES"] = "0"
      os.system("docker pull gcr.io/vorvan/h2oai/h2ogpt-runtime:0.1.0")
      datetime_str = (
          str(datetime.now()).replace(" ", "_").replace(":", "_")
      )
      msg = "Starting vLLM inference %s..." % datetime_str
      print(msg, flush=True)
      home_dir = os.path.expanduser("~")
      makedirs(os.path.join(home_dir, ".cache/huggingface/hub"))
      n_gpus = get_ngpus_vis()
      cmd = (
          ["docker"]
          + [
              "run",
              "-d",
              "--runtime",
              "nvidia",
          ]
          + gpus_cmd()
          + [
              "--shm-size",
              "10.24g",
              "-e",
              "HUGGING_FACE_HUB_TOKEN=%s"
              % os.environ["HUGGING_FACE_HUB_TOKEN"],
              "-p",
              "%s:5000" % inf_port,
              "--entrypoint",
              "/h2ogpt_conda/vllm_env/bin/python3.10",
              "-e",
              "NCCL_IGNORE_DISABLED_P2P=1",
              "-v",
              "/etc/passwd:/etc/passwd:ro",
              "-v",
              "/etc/group:/etc/group:ro",
              "-u",
              "%s:%s" % (os.getuid(), os.getgid()),
              "-v",
              "%s/.cache:/workspace/.cache" % home_dir,
              # '--network', 'host',
              "gcr.io/vorvan/h2oai/h2ogpt-runtime:0.1.0",
              # 'h2ogpt',  # use when built locally with vLLM just freshly added
              # 'docker.io/library/h2ogpt',  # use when built locally with vLLM just freshly added
              "-m",
              "vllm.entrypoints.openai.api_server",
              "--port=5000",
              "--host=0.0.0.0",
              "--model=%s" % base_model,
              "--tensor-parallel-size=%s" % n_gpus,
              "--seed",
              "1234",
              "--trust-remote-code",
              "--download-dir=/workspace/.cache/huggingface/hub",
          ]
      )
      os.environ.pop("CUDA_VISIBLE_DEVICES", None)
      if tokenizer:
          cmd.append("--tokenizer=%s" % tokenizer)
  
      print(cmd, flush=True)
      print(" ".join(cmd), flush=True)
      docker_hash = subprocess.check_output(cmd).decode().strip()
      import time
  
      connected = False
      while not connected:
          cmd = "docker logs %s" % docker_hash
          o = subprocess.check_output(cmd, shell=True, timeout=15)
          connected = "Uvicorn running on" in o.decode("utf-8")
          # somehow above message doesn't come up
          connected |= "GPU blocks" in o.decode("utf-8")
          time.sleep(5)
      print("Done starting vLLM server: %s" % docker_hash, flush=True)
      return docker_hash
  
imports: import os
  import subprocess
  import time
  from datetime import datetime
  import pytest
  from src.utils import get_ngpus_vis, makedirs
  from tests.utils import wrap_test_forked, get_inf_port, get_inf_server
  from tests.test_langchain_units import have_openai_key, have_replicate_key
  from src.client_test import run_client_many, test_client_basic_api_lean
  from src.enums import PromptType, LangChainAction
label_desc: Use image node_id 4 for calling a global function with example usage: run_vllm_docker(inf_port, base_model, tokenizer) and returns: docker_hash