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

# プラグイン用コンテナレジストリ

> このページは先行公開版です。内容は今後予告なく更新される可能性があります。

## 対応しているコンテナレジストリ

* AWS ECR（AK/SK または IRSA）/ Azure ACR / Aliyun ACR / Tencent TCR / Dockerhub / Google Artifact Registry

## コンテナレジストリが必要な理由

* **Dify Enterprise** では、プラグインイメージの保存および管理のためにコンテナレジストリが必要です。
* プラグインパッケージは Docker イメージではなく、コードとメタデータを含む圧縮ファイルです。
* Kubernetes クラスター上で実行される際、プラグインパッケージは Docker イメージとしてビルドされるため、**コンテナレジストリが必要**です。

## Helm チャートの値を表示

```bash theme={null}
helm show values dify/dify
```

以下は、Helm チャートにおけるコンテナレジストリ設定の例です：

```yaml theme={null}
plugin_connector:
  insecureImageRepo: false
  imageRepoSecret: "image-repo-secret"
  imageRepoPrefix: "docker.io/your-image-repo-prefix"
  imageRepoType: docker
  ecrRegion: "us-east-1"
```

## コンテナレジストリの設定方法

### 1. `imageRepoSecret`（必須）

Kubernetes の Secret として、レジストリ認証情報を保存します。

#### 1.1 **警告**

この Secret の名前は `image-repo-secret` で固定されており、Dify デプロイ時に作成しておく必要があります。

#### 1.2 以下のスクリプトを `generate-image-repo-secret.sh` として保存してください：

```bash theme={null}
#!/bin/bash    

if [ "$#" -lt 3 ]; then
  echo "使用方法: $0 <username> <password> <k8s-namespace> <registry: optional>"
  echo "例: $0 myuser mypass default https://index.docker.io/v1/"
  exit 1
fi

USERNAME="$1"
PASSWORD="$2"
NAMESPACE="$3"
REGISTRY="${4:-https://index.docker.io/v1/}"
OUTPUT_FILE="./config.json"

AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64 | tr -d '\n')

cat > "$OUTPUT_FILE" <<EOF
{
  "auths": {
    "$REGISTRY": {
      "auth": "$AUTH"
    }
  }
}
EOF

echo "Docker config.json を生成しました: $OUTPUT_FILE"

kubectl -n $NAMESPACE create secret generic image-repo-secret --from-file=.dockerconfigjson=$OUTPUT_FILE --from-file=config.json=$OUTPUT_FILE --type=kubernetes.io/dockerconfigjson

rm "$OUTPUT_FILE"
```

#### 1.3 実行権限を付与：

```bash theme={null}
chmod +x ./generate-image-repo-secret.sh
```

#### 1.4 スクリプトを実行して Secret を作成：

```bash theme={null}
# 例:
./generate-image-repo-secret.sh myuser mypass default https://index.docker.io/v1/
```

### 2. `imageRepoPrefix`（必須）

プラグインイメージをプッシュする際に使用する、リポジトリのプレフィックスです。

### 3. `imageRepoType`（必須）

使用するレジストリの種類：

* `docker`（デフォルト）：Docker Hub または互換レジストリ
* `ecr`：AWS ECR 用

### 4. `ecrRegion`（オプション）

ECR を使用する場合、AWS リージョンを指定します。

### 5. `insecureImageRepo`（オプション）

レジストリが HTTPS を使用していない場合は、`true` に設定します。

## プラグイン Pod の Kubernetes スケジューリング設定

```yaml theme={null}
plugin_connector:
  nodeSelector: {}
  affinity: {}
  tolerations: []
  labels: {}
```

* `plugin_connector` サービスの設定項目（`nodeSelector`、`affinity`、`tolerations`、`labels`）は、**プラグイン用 Pod にも拡張適用されます**。

## 国や地域によるネットワーク制限がある場合の設定方法

ネットワーク制限により `docker.io` にアクセスできない場合は、カスタムのイメージリポジトリを使用することができます。

```yaml theme={null}
plugin_connector:
  gatewayImage: "nginx:1.27.3"
  shaderImage: "gcr.io/kaniko-project/executor:latest"
  busyBoxImage: "busybox:latest"
  awsCliImage: "amazon/aws-cli:latest"
  generatorConf: |
    generator:
      repo: langgenius
      python:
        pipMirror: ""
        preCompile: true
        versions:
          python3.13:
            langgenius: docker.io/langgenius/plugin-build-base-python:3.13
          python3.12:
            langgenius: docker.io/langgenius/plugin-build-base-python:3.12
          python3.11:
            langgenius: docker.io/langgenius/plugin-build-base-python:3.11
          python3.10:
            langgenius: docker.io/langgenius/plugin-build-base-python:3.10
```

1. 置き換えが必要なイメージ一覧：

* `gatewayImage`: プラグインゲートウェイサービス用のイメージ
* `shaderImage`: プラグインビルド時に使用される Shader イメージ
* `busyBoxImage`: プラグイン実行時に使用される BusyBox イメージ
* `awsCliImage`: AWS CLI 用のイメージ（AWS を使用しない場合は無視して構いません）
* `python3.xx`: プラグインビルド時に使用される Python ベースのイメージ

2. イメージをプライベートレジストリへ同期する方法

各種イメージをプライベートレジストリに同期する方法については、[プライベートレジストリへのイメージ同期手順](/ja/3.6.x/deploy/advanced-configuration/container-registry#syncing-images-to-a-private-registry) をご参照ください。
