Clairãã¤ã³ã¹ãã¼ã«ãã¦ãDockerã¤ã¡ã¼ã¸ã®èå¼±æ§ã¹ãã£ã³ãããæé
Dockerã¤ã¡ã¼ã¸ã®èå¼±æ§ã¹ãã£ã³ãã¼ã«ãClairã ãã¤ã³ã¹ãã¼ã«ãã¦ããã¼ã«ã«ã®ã¤ã¡ã¼ã¸ããã§ãã¯ããæé ã§ããå¾®å¦ã«ã¯ã¾ã£ãã®ã§ã¡ã¢ã
0.ç°å¢
$ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) $ docker -v Docker version 1.10.2, build c3959b1
1.PostgreSQLãã¤ã³ã¹ãã¼ã«ãã¦èµ·å
$ docker pull postgres:latest $ docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=<ãã¹ã¯ã¼ã> -d postgres
2.clairãã¤ã³ã¹ãã¼ã«ãã¦èµ·å
$ mkdir ./clair_config $ curl -L https://raw.githubusercontent.com/coreos/clair/master/config.example.yaml -o ./clair_config/config.yaml $ vi ./clair_config/config.yaml # database - source ã以ä¸ã®éãå¤æ´ --- database: # PostgreSQL Connection string # http://www.postgresql.org/docs/9.4/static/libpq-connect.html source: postgresql://postgres:<ãã¹ã¯ã¼ã>@postgres:5432?sslmode=disable --- $ docker run -p 6060-6061:6060-6061 --link postgres:postgres -v /tmp:/tmp -v $PWD/clair_config:/config quay.io/coreos/clair -config=/config/config.yaml
èå¼±æ§ãã¼ã¿ã®èªã¿è¾¼ã¿ãéå§ãããã®ã§ã"updater: update finished" ã表示ãããã¾ã§å¾ ã¡ã¾ãã(1æéããããããã¾ããã»ã»ã»)
3.ãã¼ã«ã«ãã§ãã¯ãã¼ã«ãã¤ã³ã¹ãã¼ã«ãã¦å®è¡ã
$ sudo yum -y install golang $ export GOPATH=~/.go $ go get -u github.com/coreos/clair/contrib/analyze-local-images $ docker pull <ãã§ãã¯ãããã¤ã¡ã¼ã¸> $ sudo $GOPATH/bin/analyze-local-images <ãã§ãã¯ãããã¤ã¡ã¼ã¸>
ç¶ç¶çã«å®è¡ããã«ã¯ã©ãããããããã ããã»ã»ã»ã
追è¨: docker-compose.yml
docker-compose.yml
ãä½ã£ã¦ã¿ã¾ããã
version: '2' services: postgres: container_name: clair_postgres image: postgres:latest environment: POSTGRES_PASSWORD: <ãã¹ã¯ã¼ã> ports: - "5432:5432" volumes: - ./data:/var/lib/postgresql/data clair: container_name: clair_clair image: quay.io/coreos/clair ports: - "6060-6061:6060-6061" links: - postgres volumes: - /tmp:/tmp - ./config:/config command: [-config, /config/config.yaml]