Dckerfile: Add docker-compose.yml

This commit is contained in:
unageanu 2016-03-09 16:45:47 +09:00
parent 363cde29f4
commit 80f150f93b
2 changed files with 44 additions and 1 deletions

View File

@ -58,11 +58,33 @@ The easiest way to get an instance of Clair running is to simply pull down the l
```sh ```sh
$ mkdir $HOME/clair_config $ 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 $ $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 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].

21
docker-compose.yml Normal file
View File

@ -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]