From 80f150f93bf3b12e6c9bcea2d71ccfa956bd50c9 Mon Sep 17 00:00:00 2001 From: unageanu Date: Wed, 9 Mar 2016 16:45:47 +0900 Subject: [PATCH] Dckerfile: Add docker-compose.yml --- README.md | 24 +++++++++++++++++++++++- docker-compose.yml | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index df963a9f..99506eb8 100644 --- a/README.md +++ b/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:@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]. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e8996447 --- /dev/null +++ b/docker-compose.yml @@ -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]