> 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/bitbucket-pipeline-setup-for-local-image-scanning.md).

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

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 Imageの設定ページ](https://app.aikido.dev/settings/container-image-registry/add/localscan)
2. 認証トークンを生成してコピーします。このトークンは一度しか表示できないことに注意してください。
3. 認証トークンを Bitbucket の Repository variables に追加して、パイプラインで使用できるようにします。これを行うには、Repository Settings に移動する必要があります。次に、 **Pipelines > Repository variables.** そこで、認証トークンを追加できます。 `AIKIDO_API_KEY` をキーとして、コピーしたトークンの内容を値として追加できます。

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

これで残るのは、あなたのイメージに対してスキャナーを実行することだけです。次のサンプルファイルを参考にできます：

```yaml
image: docker:25.0.3

pipelines:
  既定値:
    - step:
        name: Dockerイメージをビルド
        image: docker:25.0.3
        services:
          - docker
        script:
          - export PATH=/usr/bin:$PATH
          - docker build -t my-image .
          - docker save --output my-image.tar my-image
        artifacts:
          - my-image.tar
    - step:
        name: Dockerイメージをスキャン
        image: aikidosecurity/local-scanner
        script:
          - aikido-local-scanner image-scan my-image.tar --image-name my-image --apikey $AIKIDO_API_KEY
```

### 3. スキャン結果を確認する <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/bitbucket-pipeline-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.
