> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 为您的 LangSmith 安装配置镜像镜像

默认情况下，LangSmith 会从我们的公共 Docker 仓库拉取镜像。但是，如果您在无法访问互联网的环境中运行 LangSmith，或者希望使用私有 Docker 仓库，您可以将镜像镜像到您自己的仓库，然后配置您的 LangSmith 安装以使用这些镜像。

## 要求

* 对您的 Kubernetes 集群/机器可访问的 Docker 仓库拥有经过身份验证的访问权限。
* 在本地机器或可访问 Docker 仓库的机器上安装 Docker。
* 一个可以运行 LangSmith 的 Kubernetes 集群或机器。

## 镜像镜像

为了方便起见，我们提供了一个脚本来帮助您镜像镜像。您可以在 [LangSmith Helm Chart 仓库](https://github.com/langchain-ai/helm/blob/main/charts/langsmith/scripts/mirror_langsmith_images.sh) 中找到该脚本。

要使用该脚本，您需要运行以下命令，指定您的仓库和平台：

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
bash mirror_images.sh <your-registry> [<platform>]
```

其中 `<your-registry>` 是您的 Docker 仓库 URL（例如 `myregistry.com`），`<platform>` 是您使用的平台（例如 `linux/amd64`、`linux/arm64` 等）。如果不指定平台，则默认为 `linux/amd64`。

例如，如果您的仓库是 `myregistry.com`，您的平台是 `linux/arm64`，并且您想使用最新版本的镜像，您将运行：

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
bash mirror_langsmith_images.sh --registry myregistry --platform linux/arm64 --version 0.10.66
```

请注意，此脚本假定您已安装 Docker 并且已通过身份验证访问您的仓库。它还会将镜像推送到指定的仓库，并使用与原始镜像相同的仓库/标签。

或者，您可以手动拉取、镜像和推送镜像。您需要镜像的镜像可以在 LangSmith Helm Chart 的 `values.yaml` 文件中找到。这些文件位于：[LangSmith Helm Chart values.yaml](https://github.com/langchain-ai/helm/blob/main/charts/langsmith/values.yaml#L14)

以下是一个使用 Docker 镜像镜像的示例：

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 从公共仓库拉取镜像
docker pull langchain/langsmith-backend:latest
docker tag langchain/langsmith-backend:latest <your-registry>/langsmith-backend:latest
docker push <your-registry>/langsmith-backend:latest
```

您需要对每个想要镜像的镜像重复此操作。

## 配置

镜像镜像完成后，您需要配置您的 LangSmith 安装以使用镜像后的镜像。您可以通过修改 LangSmith Helm Chart 安装的 `values.yaml` 文件或 Docker 安装的 `.env` 文件来实现。将标签替换为您要使用的版本，例如，在撰写本文时，最新版本为 `0.10.66`。

<CodeGroup>
  ```yaml Helm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  images:
    imagePullSecrets: [] # 如果需要，在此处添加您的镜像拉取密钥
    registry: "" # 如果您使用我们的脚本将所有镜像镜像到同一个仓库，请将此设置为您的仓库 URL。然后，您可以移除下面镜像中的仓库前缀。
    aceBackendImage:
      repository: "(your-registry)/langchain/langsmith-ace-backend"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    backendImage:
      repository: "(your-registry)/langchain/langsmith-backend"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    frontendImage:
      repository: "(your-registry)/langchain/langsmith-frontend"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    hostBackendImage:
      repository: "(your-registry)/langchain/hosted-langserve-backend"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    operatorImage:
      repository: "(your-registry)/langchain/langgraph-operator"
      pullPolicy: IfNotPresent
      tag: "6cc83a8"
    platformBackendImage:
      repository: "(your-registry)/langchain/langsmith-go-backend"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    playgroundImage:
      repository: "(your-registry)/langchain/langsmith-playground"
      pullPolicy: IfNotPresent
      tag: "0.10.66"
    postgresImage:
      repository: "(your-registry)/postgres"
      pullPolicy: IfNotPresent
      tag: "14.7"
    redisImage:
      repository: "(your-registry)/redis"
      pullPolicy: IfNotPresent
      tag: "7"
    clickhouseImage:
      repository: "(your-registry)/clickhouse/clickhouse-server"
      pullPolicy: Always
      tag: "24.8"
  ```

  ```bash Docker theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  # 在您的 .env 文件中
  _REGISTRY=your-registry # 如果您使用我们的脚本将所有镜像镜像到同一个仓库，请将此设置为您的仓库 URL。否则，您将需要在 compose 文件中手动设置每个镜像的仓库。
  ```
</CodeGroup>

## Fleet 和 Insights 的额外镜像

如果您正在使用 Fleet 或 Insights，LangGraph 操作符会为每个部署动态创建 Redis 和 PostgreSQL（pgvector）Pod。这些 Pod 使用的镜像在操作符模板中定义，需要单独配置。

您必须镜像这些额外的镜像：

* `docker.io/redis:7`
* `docker.io/pgvector/pgvector:pg15`

然后在您的 `values.yaml` 中覆盖操作符模板以使用您镜像后的镜像：

```yaml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
operator:
  templates:
    redis: |
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: ${service_name}
        namespace: ${namespace}
      spec:
        replicas: 1
        selector:
          matchLabels:
            app: ${service_name}
        template:
          metadata:
            labels:
              app: ${service_name}
          spec:
            enableServiceLinks: false
            containers:
            - name: redis
              image: (your-registry)/redis:7
              ports:
              - containerPort: 6379
                name: redis
              livenessProbe:
                exec:
                  command:
                  - redis-cli
                  - ping
                initialDelaySeconds: 30
                periodSeconds: 10
              readinessProbe:
                tcpSocket:
                  port: 6379
                initialDelaySeconds: 10
                periodSeconds: 5
    db: |
      apiVersion: apps/v1
      kind: StatefulSet
      metadata:
        name: ${service_name}
      spec:
        serviceName: ${service_name}
        selector:
          matchLabels:
            app: ${service_name}
        persistentVolumeClaimRetentionPolicy:
          whenDeleted: Delete
          whenScaled: Retain
        template:
          metadata:
            labels:
              app: ${service_name}
          spec:
            containers:
            - name: postgres
              image: (your-registry)/pgvector/pgvector:pg15
              ports:
              - containerPort: 5432
              command: ["docker-entrypoint.sh"]
              args:
                - postgres
                - -c
                - max_connections=${max_connections}
              env:
              - name: PGDATA
                value: /var/lib/postgresql/data/pgdata
              volumeMounts:
              - name: postgres-data
                mountPath: /var/lib/postgresql/data
            enableServiceLinks: false
        volumeClaimTemplates:
        - metadata:
            name: postgres-data
          spec:
            accessModes: ["ReadWriteOnce"]
            resources:
              requests:
                storage: "${storage_gi}Gi"
```

将 `(your-registry)` 替换为您的仓库 URL。模板变量（`${service_name}`、`${namespace}`、`${max_connections}`、`${storage_gi}`）由操作符在运行时替换，必须保持原样。

配置完成后，您需要更新您的 LangSmith 安装。您可以按照我们的升级指南进行操作：[升级 LangSmith](/langsmith/self-host-upgrades)。如果升级成功，您的 LangSmith 实例现在应该正在使用来自您 Docker 仓库的镜像镜像。

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\langsmith\self-host-mirroring-images.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
