Note: The master branch may be in an unstable or even broken state during development.
Please use releases instead of the master branch in order to get stable binaries.

Clair is an open source project for the static analysis of vulnerabilities in application containers (currently including appc and docker).
Our goal is to enable a more transparent view of the security of container-based infrastructure.
Thus, the project was named Clair after the French term which translates to clear, bright, transparent.
Clair is officially packaged and released as a container.
Clair is professionally supported as a data source for the Quay Security Scanning feature. The setup documentation for using Clair for this environment can be found on the Quay documentation on the CoreOS website. Be sure to adjust the version of the documentation to the version of Quay being used in your deployment.
NOTE: These instructions demonstrate running HEAD and not stable versions.
The following are community supported instructions to run Clair in a variety of ways. A database instance is required for all instructions.
Clair currently supports and tests against:
If you don't have a local Kubernetes cluster already, check out minikube.
git clone https://github.com/coreos/clair
cd clair/contrib/k8s
kubectl create secret generic clairsecret --from-file=./config.yaml
kubectl create -f clair-kubernetes.yaml
$ curl -L https://raw.githubusercontent.com/coreos/clair/master/docker-compose.yml -o $HOME/docker-compose.yml
$ mkdir $HOME/clair_config
$ curl -L https://raw.githubusercontent.com/coreos/clair/master/config.example.yaml -o $HOME/clair_config/config.yaml
$ $EDITOR $HOME/clair_config/config.yaml # Edit database source to be postgresql://postgres:password@postgres:5432?sslmode=disable
$ docker-compose -f $HOME/docker-compose.yml up -d
Docker Compose may start Clair before Postgres which will raise an error.
If this error is raised, manually execute docker-compose start clair.
$ mkdir $PWD/clair_config
$ curl -L https://raw.githubusercontent.com/coreos/clair/master/config.example.yaml -o $PWD/clair_config/config.yaml
$ docker run -d -e POSTGRES_PASSWORD="" -p 5432:5432 postgres:9.6
$ docker run -d -p 6060-6061:6060-6061 -v $PWD/clair_config:/config quay.io/coreos/clair-git:latest -config=/config/config.yaml
To build Clair, you need to latest stable version of Go and a working Go environment. In addition, Clair requires some additional binaries be installed on the system $PATH as runtime dependencies:
$ go get github.com/coreos/clair
$ go install github.com/coreos/clair/cmd/clair
$ $EDITOR config.yaml # Add the URI for your postgres database
$ ./$GOPATH/bin/clair -config=config.yaml
You can find production users and third party integrations documented in their respective pages of the local documentation.
There are two major ways to perform analysis of programs: Static Analysis and Dynamic Analysis. Clair has been designed to perform static analysis; containers never need to be executed. Rather, the filesystem of the container image is inspected and features are indexed into a database. By indexing the features of an image into the database, images only need to be rescanned when new detectors are added.
| Data Source | Data Collected | Format | License |
|---|---|---|---|
| Debian Security Bug Tracker | Debian 6, 7, 8, unstable namespaces | dpkg | Debian |
| Ubuntu CVE Tracker | Ubuntu 12.04, 12.10, 13.04, 14.04, 14.10, 15.04, 15.10, 16.04 namespaces | dpkg | GPLv2 |
| Red Hat Security Data | CentOS 5, 6, 7 namespaces | rpm | CVRF |
| Oracle Linux Security Data | Oracle Linux 5, 6, 7 namespaces | rpm | CVRF |
| Alpine SecDB | Alpine 3.3, Alpine 3.4, Alpine 3.5 namespaces | apk | MIT |
| NIST NVD | Generic Vulnerability Metadata | N/A | Public Domain |
From a high-level, most deployments integrate with the registry workflow rather than manual API usage by a human. They typically take up a form similar to the following diagram:

During the first run, Clair will bootstrap its database with vulnerability data from the configured data sources. It can take several minutes before the database has been fully populated, but once this data is stored in the database, subsequent updates will take far less time.
The major components of Clair are all programmatically extensible in the same way Go's standard database/sql package is extensible.
Everything extensible is located in the ext directory.
Custom behavior can be accomplished by creating a package that contains a type that implements an interface declared in Clair and registering that interface in init().
To expose the new behavior, unqualified imports to the package must be added in your own custom main.go, which should then start Clair using Boot(*config.Config).
Content type
Image
Digest
Size
108.5 MB
Last updated
almost 8 years ago
docker pull jlkinsel/clair:v2.0.6-viper