code: def test_docker_command_runner():
      process_runner = MockProcessRunner()
      provider = MockProvider()
      provider.create_node({}, {}, 1)
      cluster_name = "cluster"
      ssh_control_hash = hashlib.sha1(cluster_name.encode()).hexdigest()
      ssh_user_hash = hashlib.sha1(getuser().encode()).hexdigest()
      ssh_control_path = "/tmp/ray_ssh_{}/{}".format(
          ssh_user_hash[:10], ssh_control_hash[:10]
      )
      docker_config = {"container_name": "container"}
      args = {
          "log_prefix": "prefix",
          "node_id": "0",
          "provider": provider,
          "auth_config": auth_config,
          "cluster_name": cluster_name,
          "process_runner": process_runner,
          "use_internal_ip": False,
          "docker_config": docker_config,
      }
      cmd_runner = DockerCommandRunner(**args)
      assert (
          len(process_runner.calls) == 0
      ), "No calls should be made in ctor"
  
      env_vars = {
          "var1": 'quote between this " and this',
          "var2": "123",
      }
      cmd_runner.run("echo hello", environment_variables=env_vars)
  
      # This string is insane because there are an absurd number of embedded
      # quotes. While this is a ridiculous string, the escape behavior is
      # important and somewhat difficult to get right for environment variables.
      cmd = """'source ~/.bashrc; export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && (docker exec -it  container /bin/bash -c '"'"'bash --login -c -i '"'"'"'"'"'"'"'"'source ~/.bashrc; export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && (export var1='"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"quote between this \\" and this"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"';export var2='"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"123"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"';echo hello)'"'"'"'"'"'"'"'"''"'"' )'"""  # noqa: E501
  
      expected = [
          "ssh",
          "-tt",
          "-i",
          "8265.pem",
          "-o",
          "StrictHostKeyChecking=no",
          "-o",
          "UserKnownHostsFile=/dev/null",
          "-o",
          "IdentitiesOnly=yes",
          "-o",
          "ExitOnForwardFailure=yes",
          "-o",
          "ServerAliveInterval=5",
          "-o",
          "ServerAliveCountMax=3",
          "-o",
          "ControlMaster=auto",
          "-o",
          "ControlPath={}/%C".format(ssh_control_path),
          "-o",
          "ControlPersist=10s",
          "-o",
          "ConnectTimeout=120s",
          "ray@1.2.3.4",
          "bash",
          "--login",
          "-c",
          "-i",
          cmd,
      ]
      # Much easier to debug this loop than the function call.
      for x, y in zip(process_runner.calls[0], expected):
          print(f"expeted:\t{y}")
          print(f"actual: \t{x}")
          assert x == y
      process_runner.assert_has_call("1.2.3.4", exact=expected)
  
file_path: ray/python/ray/tests/test_command_runner.py
imports: import pytest
  from ray.tests.test_autoscaler import MockProvider, MockProcessRunner
  from ray.autoscaler.command_runner import CommandRunnerInterface
  from ray.autoscaler._private.command_runner import SSHCommandRunner, DockerCommandRunner, _with_environment_variables
  from ray.autoscaler.sdk import get_docker_host_mount_location
  from getpass import getuser
  import hashlib
label_desc: Use image node_id 5 for calling a global function with example usage: test_docker_command_runner() without return types