Skip to content

Commit

Permalink
Dckerfile: Add docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
unageanu committed Mar 9, 2016
1 parent 363cde2 commit 80f150f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '2'
services:
postgres:
container_name: clair_postgres
image: postgres:latest
environment:
POSTGRES_PASSWORD: postgres

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]

0 comments on commit 80f150f

Please sign in to comment.