vmware-tanzu/cloud-native-security-inspector

Trivy container failed to work if using any K8s cluster other than KIND

JingChen23 opened this issue · 0 comments

Meet this log when testing by a K8s cluster launched by Minikube, and also by Kubeadm.

{"error":"running trivy wrapper: running trivy: exit status 1: 2023-06-15T06:37:58.919Z\t\u001b[34mINFO\u001b[0m\tVulnerability scanning is enabled\n2023-06-15T06:37:58.919Z\t\u001b[34mINFO\u001b[0m\tMisconfiguration scanning is enabled\n2023-06-15T06:37:58.919Z\t\u001b[34mINFO\u001b[0m\tLicense scanning is enabled\n2023-06-15T06:37:59.461Z\t\u001b[31mFATAL\u001b[0m\timage scan error: scan error: unable to initialize a scanner: unable to initialize a docker scanner: 4 errors occurred:\n\t* unable to inspect the image (docker-pullable//bitnami/prometheus-operator@sha256:b9afc63f82fbfa65a3e8f67fa619e7effb8a1ccb8dd4ae6b7b835eb3b6bbc945): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?\n\t* unable to initialize Podman client: no podman socket found: stat podman/podman.sock: no such file or directory\n\t* containerd socket not found: /run/containerd/containerd.sock\n\t* GET https://auth.docker.io/token?scope=repository%3Adocker-pullable%2F%2Fbitnami%2Fprometheus-operator%3Apull\u0026service=registry.docker.io: unexpected status code 400 Bad Request: {"details":"invalid repository name"}\n\n\n\n","level":"error","msg":"Scan job failed","scan_job_id":"d17824c7b129cdbae7e7e9eb","time":"2023-06-15T06:38:16Z"}

This could be due to that KIND cluster is rootless, or the docker.sock file is not mounted into the container.