Merge pull request #94 from unageanu/support-docker-compose
Dockerfile: Add docker-compose.yml
This commit is contained in:
commit
1c5a7a4667
24
README.md
24
README.md
@ -58,11 +58,33 @@ The easiest way to get an instance of Clair running is to simply pull down the l
|
||||
|
||||
```sh
|
||||
$ mkdir $HOME/clair_config
|
||||
$ curl -L https://raw.githubusercontent.com/coreos/clair/config.example.yaml -o $HOME/clair_config/config.yaml
|
||||
$ 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
|
||||
$ 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
|
||||
|
||||
To build Clair, you need to latest stable version of [Go] and a working [Go environment].
|
||||
|
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
||||
version: '2'
|
||||
services:
|
||||
postgres:
|
||||
container_name: clair_postgres
|
||||
image: postgres:latest
|
||||
environment:
|
||||
POSTGRES_PASSWORD: <SET POSTGRES PASSWORD>
|
||||
|
||||
clair:
|
||||
container_name: clair_clair
|
||||
image: quay.io/coreos/clair
|
||||
depends_on:
|
||||
- postgres
|
||||
ports:
|
||||
- "6060-6061:6060-6061"
|
||||
links:
|
||||
- postgres
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
- ./clair_config:/config
|
||||
command: [-config, /config/config.yaml]
|
Loading…
Reference in New Issue
Block a user