code: def _update_docker_status(
      docker_compose_path: str,
      project_name: str,
      docker_status_path: str,
  ):
      data_str = ""
      try:
          data_str = (
              subprocess.check_output(
                  [
                      "docker",
                      "compose",
                      "-f",
                      docker_compose_path,
                      "-p",
                      project_name,
                      "ps",
                      "--format",
                      "json",
                  ]
              )
              .decode("utf-8")
              .strip()
              .split("\n")
          )
          data: List[Dict[str, str]] = []
          for line in data_str:
              data.append(json.loads(line))
      except Exception as e:
          print(f"Ran into error when fetching status: {e}")
          return None
  
      status = {}
      for container in data:
          node_id = container["Service"]
          container_name = container["Name"]
          if container["State"] == "running":
              ip = _get_ip(project_name, container_name)
          else:
              ip = ""
          container["IP"] = ip
          status[node_id] = container
  
      with open(docker_status_path, "wt") as f:
          json.dump(status, f)
  
      return status
  
file_path: ray/python/ray/autoscaler/_private/fake_multi_node/docker_monitor.py
imports: import argparse
  import json
  import os
  import shutil
  import subprocess
  import time
  from typing import Any, Dict, List, Optional
  import yaml
label_desc: Use image node_id 4 for calling a global function with example usage: _update_docker_status(docker_compose_path, project_name, docker_status_path) and returns: status, None