README: Update Docker Compose instructions
This commit is contained in:
parent
1c5a7a4667
commit
f6ba17dfc7
51
README.md
51
README.md
@ -41,20 +41,33 @@ Clair detects some vulnerabilities and sends a webhook to your continuous deploy
|
|||||||
|
|
||||||
## Hello Heartbleed
|
## Hello Heartbleed
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
All instructions assume the user has already setup the following:
|
|
||||||
|
|
||||||
- A running instance of [PostgreSQL] 9.4+
|
|
||||||
|
|
||||||
During the first run, Clair will bootstrap its database with vulnerability data from its data sources.
|
During the first run, Clair will bootstrap its database with vulnerability data from its data sources.
|
||||||
It can take several minutes before the database has been fully populated.
|
It can take several minutes before the database has been fully populated.
|
||||||
|
|
||||||
[PostgreSQL]: http://postgresql.org
|
### Docker Compose
|
||||||
|
|
||||||
|
The easiest way to get an instance of Clair running is to use Docker Compose to run everything locally.
|
||||||
|
This runs a PostgreSQL database insecurely and locally in a container.
|
||||||
|
This method should only be used for testing.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ 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 start clair_clair`.
|
||||||
|
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
The easiest way to get an instance of Clair running is to simply pull down the latest copy from Quay.
|
This method assumes you already have a [PostgreSQL 9.4+] database running.
|
||||||
|
This is the recommended method for production deployments.
|
||||||
|
|
||||||
|
[PostgreSQL 9.4+]: http://postgresql.org
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ mkdir $HOME/clair_config
|
$ mkdir $HOME/clair_config
|
||||||
@ -63,28 +76,6 @@ $ $EDITOR $HOME/clair_config/config.yaml # Add the URI for your postgres databas
|
|||||||
$ docker run -p 6060-6061:6060-6061 -v $HOME/clair_config:/config quay.io/coreos/clair -config=/config/config.yaml
|
$ docker run -p 6060-6061:6060-6061 -v $HOME/clair_config:/config quay.io/coreos/clair -config=/config/config.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker Compose
|
|
||||||
|
|
||||||
Or, You can run an instance of Clair and PosrgreSQL using a docker-compose.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ curl -L https://raw.githubusercontent.com/coreos/clair/master/docker-compose.yml -o $HOME/docker-compose.yml
|
|
||||||
$ $EDITOR $HOME/docker-compose.yml # Edit POSTGRES_PASSWORD.
|
|
||||||
$ 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 # Add the URI for your postgres database. (see example below)
|
|
||||||
--
|
|
||||||
database:
|
|
||||||
# PostgreSQL Connection string
|
|
||||||
# http://www.postgresql.org/docs/9.4/static/libpq-connect.html
|
|
||||||
source: postgresql://postgres:<YOUR POSTGRES PASSWORD>@postgres:5432?sslmode=disable
|
|
||||||
--
|
|
||||||
$ docker-compose -f $HOME/docker-compose.yml up -d
|
|
||||||
# if execution of Clair has failed, please try to re-start.
|
|
||||||
# it will fail when Clair is started before the PostgreSQL start a service.
|
|
||||||
# $ docker start clair_clair
|
|
||||||
```
|
|
||||||
|
|
||||||
### Source
|
### Source
|
||||||
|
|
||||||
To build Clair, you need to latest stable version of [Go] and a working [Go environment].
|
To build Clair, you need to latest stable version of [Go] and a working [Go environment].
|
||||||
|
@ -4,7 +4,7 @@ services:
|
|||||||
container_name: clair_postgres
|
container_name: clair_postgres
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: <SET POSTGRES PASSWORD>
|
POSTGRES_PASSWORD: password
|
||||||
|
|
||||||
clair:
|
clair:
|
||||||
container_name: clair_clair
|
container_name: clair_clair
|
||||||
@ -14,7 +14,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "6060-6061:6060-6061"
|
- "6060-6061:6060-6061"
|
||||||
links:
|
links:
|
||||||
- postgres
|
- postgres
|
||||||
volumes:
|
volumes:
|
||||||
- /tmp:/tmp
|
- /tmp:/tmp
|
||||||
- ./clair_config:/config
|
- ./clair_config:/config
|
||||||
|
Loading…
Reference in New Issue
Block a user