code: def auth(
      self,
      repo: str,
      *,
      registry: Optional[str] = None,
      token: Optional[str] = None,
  ):
      self.registry = registry
      self.repo = repo
  
      if not token:
          auth_host = registry
          params = {"scope": f"repository:{repo}:pull"}
          if not registry:
              auth_host = "auth.docker.io"
              params["service"] = "registry.docker.io"
  
          r = requests.get(f"https://{auth_host}/token", params=params)
          r.raise_for_status()
          token = r.json()["token"]
      self.s.headers = {"Authorization": f"Bearer {token}"}
  
file_path: dstack/src/dstack/_internal/server/services/docker.py
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Optional
  import requests
label_desc: Use image node_id 2 for calling the DockerRegistryClient obj's underlying member method code with example usage: obj.auth(repo) without return types