quay / clair

Vulnerability Static Analysis for Containers

Home Page:https://quay.github.io/clair/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clair server (v4.3.6) did not start when we do "docker-compose up -d"

Kinjal05 opened this issue · comments

Description of Problem / Feature Request

When I do "docker-compose up -d" from clair directory, clair server keeps on restarting mode. It doesn't come up.`

Expected Outcome

$ docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------
clair_clair_1 /usr/local/bin/catatonit - ... Up
clair_clairctl_1 /usr/sbin/crond -f Up 44480/tcp
clair_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
registry /entrypoint.sh /etc/docker ... Up 0.0.0.0:5000->5000/tcp

Actual Outcome

$ docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------
clair_clair_1 /usr/local/bin/catatonit - ... Restarting
clair_clairctl_1 /usr/sbin/crond -f Up 44480/tcp
clair_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
registry /entrypoint.sh /etc/docker ... Up 0.0.0.0:5000->5000/tcp

Environment

  • Clair version/image: 4.3.6
  • Clair client name/version: NA
  • Host OS: Linux
  • Kernel (e.g. uname -a):
  • Kubernetes version (use kubectl version): NA
  • Network/Firewall setup: HTTP/HTTPS/NO_PROXY corporate proxy

Any help will be much appreciated.

Thanks,
Kinjal

Please post log output from the clair container.

Hello @hdonnay,

Thanks for your help. I have attached log output below, please take a look.

$ docker-compose ps
Name Command State Ports

clair_clair_1 /usr/local/bin/catatonit - ... Restarting
clair_clairctl_1 /usr/sbin/crond -f Up 44480/tcp
clair_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
registry /entrypoint.sh /etc/docker ... Up 0.0.0.0:5000->5000/tcp
bash-4.2$ docker logs --tail 50 --follow --timestamps clair_clair_1
2022-02-09T16:14:19.926556236Z -mode value
2022-02-09T16:14:19.926562146Z The operation mode for this server. (default combo)
2022-02-09T16:14:20.935297484Z flag provided but not defined: -config
2022-02-09T16:14:20.935321208Z Usage of /bin/clair:
2022-02-09T16:14:20.935326561Z -conf value
2022-02-09T16:14:20.935331147Z The file system path to Clair's config file.
2022-02-09T16:14:20.935336487Z -mode value
2022-02-09T16:14:20.935340912Z The operation mode for this server. (default combo)
2022-02-09T16:14:22.131784888Z flag provided but not defined: -config
2022-02-09T16:14:22.131815185Z Usage of /bin/clair:
2022-02-09T16:14:22.131824383Z -conf value
2022-02-09T16:14:22.131831697Z The file system path to Clair's config file.
2022-02-09T16:14:22.131838966Z -mode value
2022-02-09T16:14:22.131845177Z The operation mode for this server. (default combo)
2022-02-09T16:14:23.720325620Z flag provided but not defined: -config
2022-02-09T16:14:23.720355375Z Usage of /bin/clair:
2022-02-09T16:14:23.720363024Z -conf value
2022-02-09T16:14:23.720369696Z The file system path to Clair's config file.
2022-02-09T16:14:23.720376293Z -mode value
2022-02-09T16:14:23.720382535Z The operation mode for this server. (default combo)
2022-02-09T16:14:26.137168001Z flag provided but not defined: -config
2022-02-09T16:14:26.137221806Z Usage of /bin/clair:
2022-02-09T16:14:26.137230239Z -conf value
2022-02-09T16:14:26.137237633Z The file system path to Clair's config file.
2022-02-09T16:14:26.137245348Z -mode value
2022-02-09T16:14:26.137267681Z The operation mode for this server. (default combo)
2022-02-09T16:14:30.137173496Z flag provided but not defined: -config
2022-02-09T16:14:30.137201197Z Usage of /bin/clair:
2022-02-09T16:14:30.137209116Z -conf value
2022-02-09T16:14:30.137215888Z The file system path to Clair's config file.
2022-02-09T16:14:30.137231930Z -mode value
2022-02-09T16:14:30.137238135Z The operation mode for this server. (default combo)
2022-02-09T16:14:37.340707342Z flag provided but not defined: -config
2022-02-09T16:14:37.340742177Z Usage of /bin/clair:
2022-02-09T16:14:37.340750305Z -conf value
2022-02-09T16:14:37.340757143Z The file system path to Clair's config file.
2022-02-09T16:14:37.340764255Z -mode value
2022-02-09T16:14:37.340771120Z The operation mode for this server. (default combo)

Please share your thoughts as early as possible, I am struggling to resolve this error.

Thanks,
Kinjal

The docker-compose file in the v4.3.6 release needs to be used via the Makefile.

@hdonnay, Can you please share the detailed steps of it. I am little new to clair and its architecture.

Thanks,
Kinjal

You can run make local-dev-up in a 4.3.6 release checkout, although if you're doing development I'd recommend just using the main branch, which will start correctly just using docker-compose.

If you're looking to deploy clair as a service, I'd recommend looking at the deployment doc and tailoring that to your environment.

I tried the 4.3.6 release but that too clair server is not coming up, it keeps on restarting, meaning it will never come in Up state.

if possible can you please provide docker-compose.yaml file which is running because the file which is there in repo, I think it is not working.

On main, docker-compose up works.

Hi @hdonnay,

Still clair server is not coming up.

bash-4.2$ docker-compose ps
Name Command State Ports

clair_clair_1 /usr/local/bin/catatonit - ... Restarting
clair_clairctl_1 /usr/sbin/crond -f Up 44480/tcp
clair_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp

Can you please share detailed steps for version:4.3.6.

Thanks,
Kinjal

You can run make local-dev-up in a 4.3.6 release checkout. On main, you can just use docker-compose directly.

I can't be any more help without knowing what you're doing, as the output you're pasting doesn't seem like it's from any docker-compose.yaml from this project. Neither the version in main nor the version in v4.3.6 have a clairctl container, use a container that has catatonit, or use containers with those names.

Hello @hdonnay

As per your suggestion, I have tried just docker-compose up -d after cloning the repo locally, facing below issue.

bash-4.2$ docker-compose ps
Name Command State Ports

clair-database docker-entrypoint.sh postgres Up (healthy) 5432/tcp
clair-indexer go run -mod=vendor . -conf ... Restarting
clair-matcher go run -mod=vendor . -conf ... Restarting
clair-traefik /entrypoint.sh traefik Up 0.0.0.0:9003->5432/tcp, 0.0.0.0:6060->6060/tcp, 80/tcp,
0.0.0.0:8080->8080/tcp, 0.0.0.0:9002->8443/tcp

Logs:
$ docker logs --tail 5 --follow --timestamps clair-matcher
2022-02-15T17:12:46.123601897Z go.opentelemetry.io/otel@v0.16.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:12:46.123605930Z go.opentelemetry.io/otel/exporters/stdout@v0.16.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:12:46.123609931Z go.opentelemetry.io/otel/exporters/trace/jaeger@v0.16.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

Please suggest the way to make clair-indexer and clair-matcher up and running.

Thanks,
Kinjal

Run go mod vendor to populate the vendor directory.

I have tried go mod vendor but still facing same issue.

2022-02-15T17:44:48.050902027Z golang.org/x/net@v0.0.0-20210805182204-aaa1db679c0d: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:44:48.050908089Z golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:44:48.050914038Z golang.org/x/time@v0.0.0-20210220033141-f8bda1e9f3ba: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:44:48.050920073Z gopkg.in/square/go-jose.v2@v2.5.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:44:48.050925657Z gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
2022-02-15T17:44:48.050933971Z github.com/quay/clair/config: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
2022-02-15T17:44:48.050938095Z
2022-02-15T17:44:48.050942396Z To ignore the vendor directory, use -mod=readonly or -mod=mod.
2022-02-15T17:44:48.050946378Z To sync the vendor directory, run:
2022-02-15T17:44:48.050950272Z go mod vendor

Please suggest the way to make clair-indexer and clair-matcher up and running.

Thanks,
Kinjal

You need to run go mod vendor before docker-compose. If you've already created containers, they need to be recreated.

Hello, i had the same problem and i solved it with the following steps:

  • Make sure that you have installed go >= 1.16 in the host machine
  • docker-compose down
  • go mod tidy
  • go mod vendor
  • docker-compose up -d