Skip to content

Clair

13 commands

An open-source service for static analysis of vulnerabilities in container images, typically used with registries via clairctl.

  • vulnerability scanning
  • containers
  • registry

Install Clair

docker pull quay.io/projectquay/clair:latest

Reports5

clairctl report <image>

Submits an image’s manifest to a Clair server and prints the vulnerabilities it finds.

Link
clairctl report -o json <image>

JSON output for scripting.

Link
clairctl report -o xml <image>

XML output (for example for older CI plug-ins).

Link
clairctl --host <url> report <image>

Points at a specific Clair instance.

Link
clairctl -D report <image>

Debug logging, useful when an image fails to index.

Link

Server4

clair -conf <config>

Starts Clair. The mode setting (combo, indexer, matcher, notifier) decides which services run.

Link
docker run -p 6060:6060 -v <dir>:/config quay.io/projectquay/clair:<version> -conf /config/config.yaml

Runs Clair in a container. It needs a PostgreSQL database configured in config.yaml.

Link
curl http://<host>:6061/healthz

Checks the introspection health endpoint.

Link
curl http://<host>:6061/metrics

Prometheus metrics, including indexing and matching latency.

Link

Offline databases2

clairctl export-updaters <file>

Downloads vulnerability data on a connected machine for an air-gapped install.

Link
clairctl import-updaters <file>

Imports exported vulnerability data into an offline Clair database.

Link

API2

curl -X POST http://<host>:6060/indexer/api/v1/index_report -d @<manifest>

Indexes an image manifest directly through the API.

Link
curl http://<host>:6060/matcher/api/v1/vulnerability_report/<digest>

Fetches the vulnerability report for an indexed manifest digest.

Link