> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/kontenaimjisukyan/local-image-scanning/jenkins-setup-for-local-image-scanning.md).

# ローカルイメージスキャンのための Jenkins 設定

Aikido Security Local Scanner は、お使いの環境内で Aikido Security のスキャンを実行できるツールで、データが決して外部に出ないことを保証します。スキャンはローカルで行われ、その後結果が Aikido Security プラットフォームにアップロードされます。この仕組みにより、レジストリに送信される前に、自分のマシン上または CI/CD パイプライン内で任意のイメージをローカルにスキャンできます。

## イメージのローカルスキャンを設定する方法 <a href="#how-to-set-up-local-scanning-for-images" id="how-to-set-up-local-scanning-for-images"></a>

### 1. 認証トークンを取得する <a href="#id-1-get-your-authentication-token" id="id-1-get-your-authentication-token"></a>

1. 次の [Local Scanner イメージのセットアップページ](https://app.aikido.dev/settings/container-image-registry/add/localscan)
2. 認証トークンを生成してコピーします。このトークンは 1 回しか表示できないことに注意してください。
3. このトークンを引数として追加する `--apikey` プロジェクトで Local Scanner を実行する際。
4. このトークンを Jenkins に保存します。これを行うには、Jenkins 設定の「Credentials」ページに移動します。

![グローバルで使用する新しいシークレットテキスト資格情報を追加するための Jenkins インターフェース。](/files/57bfdec4e36af69409675c984c6ceb50d7f4305d)

### 2. ローカルスキャナーをプロジェクトに追加する <a href="#id-2-adding-the-local-scanner-to-your-project" id="id-2-adding-the-local-scanner-to-your-project"></a>

Aikido UI から local scanner のバイナリをダウンロードします。Jenkins では、ビルドノードに追加し、/usr/local/bin に配置して名前で実行できるようにします。バイナリが実行可能であることを確認してください（例: `chmod +x -R aikido-local-scanner`）。Docker がインストールされているランナーを使用している場合は、この手順を省略して Local Scanner の Docker イメージを使用してスキャンを実行できます（以下を参照）。

### 3. ローカルスキャナーを実行する <a href="#id-3-running-the-local-scanner" id="id-3-running-the-local-scanner"></a>

あとは、リポジトリでスキャナーを実行するだけです。\
​\
ローカルスキャナーはデフォルトブランチでのみトリガーされるようにしてください。デフォルトでは、Aikido は依存関係およびコードの問題について、リポジトリ内の 1 つのブランチのみをスキャンできます。通常は main または master ブランチです。そのため、Aikido プラットフォーム上でスキャン結果が混ざらないように、ローカルスキャナーはそのブランチでのみ実行することを推奨します。git を使用している場合は、次の項目でこれを指定できます。 *ビルドするブランチ* セクション。

![Jenkins を「main」ブランチのみをビルドするように構成します。](/files/ea945e1a3eeeb8d8e39298f9d61a5bc91d34263f)

次に、ビルド環境に追加して、プロジェクト内で API キーを使用できるようにします。

![ビルド環境で Aikido 用のシークレット API キーバインディングを構成します。](/files/67ae2971d337ac797bf8e03fe7fdd66755853448)

次の内容で、プロジェクトに「Execute shell」ステップを追加します。イメージ名を使用することも、イメージの tar アーティファクトへのパスを使用することもできます。

```shellscript
aikido-local-scanner image-scan your-image --apikey $AIKIDO_API_KEY
```

または、当社の docker イメージを使用している場合は

```shellscript
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aikidosecurity/local-scanner image-scan your-image --apikey $AIKIDO_API_KEY
```

レジストリに push する前にリリースゲート付きスキャンを実行するには、次を追加できます `--fail-on critical` を上記のコマンドに追加します。必要なゲート条件に合わせて重大度を調整してください。

### 4. スキャン結果を確認する <a href="#id-4-check-your-scanning-results" id="id-4-check-your-scanning-results"></a>

最初のスキャンが完了したら、Aikido Feed に移動して結果を確認できます。指定した名前のイメージが Aikido UI に作成され、スキャンのすべての結果が含まれます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/kontenaimjisukyan/local-image-scanning/jenkins-setup-for-local-image-scanning.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
