# Options CLI pour l'analyse d'images en local

Options CLI pour l'analyse d'images :

```
Usage: aikido-local-scanner image-scan [options] <image>

Run an image scan.

Arguments:
  image                            The image you want to scan.

Options:
  --apikey <apikey>                Apikey to send scanning results to Aikido.  (env: AIKIDO_API_KEY)
  --platform <platform>            Set platform (to pull arm64 image on a amd64 system for example)
  --image-name <name>              Specify a name for the scanned image. This overwrites the default behaviour of deducting the image name from the <image> argument. Can be used to specify a descriptive name if the image name is not.
  --multi-arch <arch>              Run a separate scan for each given architecture (e.g. linux/amd64). Specify this option multiple times to scan multiple architectures. Each architecture is reported under a unique image name (<image-name>-<arch>), and when combined with --output-cyclonedx-json each architecture is written to its own file (<name>-<arch>.json). Not supported in gating mode and cannot be combined with --platform.
  --tag <tag>                      Specify a tag for the scanned image for reporting purposes. This overwrites the default behaviour of deducting the tag from the <image> or <image-name> argument.
  --debug                          Add additional debug information to command output.
  --fail-on <severity>             Runs scanner in gating mode and fails on the given severity or higher. (choices: "low", "medium", "high", "critical")
  --gating-mode <mode>             Indicate whether the scanner should run in release or PR gating mode. Release gating mode scans your main branch and waits to see if there are any issues that should prevent release, in pull request mode, Aikido seeks ONLY new vulnerabilities introduced in a branch. You must supply a base and head commit for the comparison to work. Should be combined with the --fail-on flag (choices: "release", "pr", default: "release")
  --sla-mode                       In release gating mode, only fail the gate on issues that are out of SLA.
  --base-commit-id <commit-id>     Base commit id, this is the commit that Aikido will compare against to determine if a finding is new. Only used for PR gating mode.
  --head-commit-id <commit-id>     Head commit id, the commit that is being scanned. Only used for PR gating mode.
  --gating-result-output <output>  JSON file to write issues to (when running in gating mode only)
  --no-fail-on-timeout             Do not fail the process in case the scan result polling times out (release gating mode only)
  --max-polling-attempts <amount>  Amount of times to poll for scan results, increase this if the default value of 20 is not enough (release gating mode only)
  --linked-team-name <name>        Team name to link the image to.
  --force-create-image-for-tag     Create a new image in Aikido with the tag instead of updating the tag on existing image.
  --scan-timeout <timeout>         Timeout in milliseconds for each scan (defaults to 900000ms).
  --output-cyclonedx-json <output> JSON file to write CycloneDX JSON SBOM to.
  --scan-javascript-lockfiles      Also detect JavaScript packages from lockfiles (e.g. package-lock.json, yarn.lock) found inside the image, in addition to installed packages.
  --enable-proxy                   Uses HTTPS_PROXY environment variable to proxy requests.
  --ca-bundle <path>               Path to a PEM file containing custom root CA(s) to trust when using --enable-proxy. (env: AIKIDO_CA_BUNDLE)
  --disable-telemetry              Disable all error reporting (telemetry) to Aikido. (env: AIKIDO_DISABLE_TELEMETRY)
  --linked-repository-name <name>  Repository name to link the image to.
  -h, --help                       display help for command
```

Pour les options CLI d'analyse de dépôts, voir [ici](https://help.aikido.dev/docs/docs-fr/code-scanning/local-code-scanning/cli-options-for-local-scanner.md).

## Cas d'utilisation courants

Vous trouverez ci-dessous quelques exemples de configurations pour des cas d'utilisation courants.

**Je veux lancer une analyse d'image**

```shellscript
aikido-local-scanner image-scan my-image
--apikey AIK_CI_xxx 
```

**Je veux lancer une analyse d'image et lier l'image à l'équipe « Cloud Team »**

```shellscript
aikido-local-scanner image-scan my-image
--apikey AIK_CI_xxx 
--linked-team-name "Cloud Team"
```

**Je veux lancer une analyse d'image et lier l'image aux équipes « Dev Team 1 » et « Dev Team 2 »**

```shellscript
aikido-local-scanner image-scan my-image 
--apikey AIK_CI_xxx 
--linked-team-name "Dev Team 1"
--linked-team-name "Dev Team 2"
```

**Je veux lancer une analyse d'image et exporter le SBOM dans un fichier JSON**

```shellscript
aikido-local-scanner image-scan my-image
--apikey AIK_CI_xxx 
--output-cyclonedx-json sbom.json
```

**Je veux analyser un répertoire de binaires et générer un SBOM CycloneDX**

```shellscript
aikido-local-scanner image-scan /path/to/directory \
--apikey AIK_CI_xxx \
--image-name my-product \
--output-cyclonedx-json sbom.json
```

L'analyse crée également un conteneur dans votre espace de travail. Voir [Analyse d'artefacts compilés avec Local Scanner](https://help.aikido.dev/docs/docs-fr/container-image-scanning/local-image-scanning/file-system-scanning-with-local-scanner.md).

**Je veux lancer une analyse d'image sur une image de registre pour plusieurs architectures en une seule commande. Cela créera une image distincte dans le flux avec les résultats pour chaque architecture.**

```shellscript
aikido-local-scanner image-scan my-image
--apikey AIK_CI_xxx 
--multi-arch linux/amd64
--multi-arch linux/arm64
```
