code: def docker_run(ctx, docker_run_args, help):
      
      args = list(docker_run_args)
      if len(args) > 0 and args[0] == "run":
          args.pop(0)
      if help or len(args) == 0:
          wandb.termlog("This commands adds wandb env variables to your docker run calls")
          subprocess.call(['docker', 'run'] + args + ['--help'])
          exit()
      #TODO: is this what we want?
      if len([a for a in args if a.startswith("--runtime")]) == 0 and find_executable('nvidia-docker'):
          args = ["--runtime", "nvidia"] + args
      #TODO: image_from_docker_args uses heuristics to find the docker image arg, there are likely cases
      #where this won't work
      image = util.image_from_docker_args(args)
      resolved_image = None
      if image:
          resolved_image = wandb.docker.image_id(image)
      if resolved_image:
          args = ['-e', 'WANDB_DOCKER=%s' % resolved_image] + args
      else:
          wandb.termlog("Couldn't detect image argument, running command without the WANDB_DOCKER env variable")
      if api.api_key:
          args = ['-e', 'WANDB_API_KEY=%s' % api.api_key] + args
      else:
          wandb.termlog("Not logged in, run `wandb login` from the host machine to enable result logging")
      subprocess.call(['docker', 'run'] + args)
docs: Simple docker wrapper that adds WANDB_API_KEY and WANDB_DOCKER to any docker run command.
      This will also set the runtime to nvidia if the nvidia-docker executable is present on the system
      and --runtime wasn't set.