Reputation: 119
My GitLab CI/CD pipeline is comprised entirely of containers that run on the Docker executor on my Runner. As such, I presume I'm meant to use Trivy's second block of code here, where the Trivy image is fetched like all the other jobs in my pipeline do. However, when I do this, I get the following error:
$ time trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@/contrib/gitlab.tpl" --output "$CI_PROJECT_DIR/gl-container-scanning-report.json" "$FULL_IMAGE_NAME"
2021-11-18T22:24:38.464Z FATAL scan error: unable to initialize a scanner: unable to initialize a docker scanner: 3 errors occurred:
* unable to inspect the image (registry.gitlab.com/my-repo:main): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
* unable to initialize Podman client: no podman socket found: stat podman/podman.sock: no such file or directory
* GET https://registry.gitlab.com/v2/my-repo/manifests/main: MANIFEST_UNKNOWN: manifest unknown; map[Tag:main]
Command exited with non-zero status 1
I've tried Googling these errors and I'm not finding much. I'm nowhere near a DevOps SME, so if there's something wrong with my GitLab environment, I don't know what it could be... all the other jobs in my pipeline (Terraform, Ansible, SonarQube) work fine. The Docker executor is working fine on the Runner so I'm not sure why it can't connect to Docker. I have no idea what Podman even is or how it applies here. There isn't much documentation on Trivy's site either that would explain other prerequisites that I might have missed. I'm literally using their code, so I'm confused as to why it's not working. Any help is appreciated.
Upvotes: 2
Views: 2041