Closed exiett closed 1 year ago
How are you running Podman?
Hey, at the end of the day, I was able to fix it. It's a problem with the Podman Socket not being correctly exported. After configuring...
export DOCKER_HOST='unix:///Users/<MY_USER>/.local/share/containers/podman/machine/podman-machine-default/podman.sock'
... on .zshrc
, Trivy runs flawlessly.
Good to hear. Thanks for updating.
For a little more context, you can find the path via podman machine inspect
. Then, export the DOCKER_HOST
variable using the path with a unix://
prefix. So the command would be DOCKER_HOST='unix://${PODMAN_INSPECT_SOCK_PATH}'
For a little more context, you can find the path via
podman machine inspect
. Then, export theDOCKER_HOST
variable using the path with aunix://
prefix. So the command would beDOCKER_HOST='unix://${PODMAN_INSPECT_SOCK_PATH}'
This can be combined using Podman's template formatting:
$ export DOCKER_HOST="unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')"
I have podman on Windows 11 and I have the problem that I can't do it with a local image.
$ podman machine inspect
[ { "ConfigPath": { "Path": "C:\Users\f.lorenzo.gomis\.config\containers\podman\machine\wsl\podman-machine-default.json" }, "ConnectionInfo": { "PodmanSocket": null, "PodmanPipe": { "Path": "\\.\pipe\podman-machine-default" } }, "Created": "2023-11-06T10:48:32.3547618+01:00", "Image": { "IgnitionFilePath": { "Path": "" }, "ImageStream": "35", "ImagePath": { "Path": "C:\Users\f.lorenzo.gomis\.local\share\containers\podman\machine\wsl\podman-machine-default_fedora-podman-amd64-v38.0.34.tar" } }, "LastUp": "2023-11-06T16:13:33.5144735+01:00", "Name": "podman-machine-default", "Resources": { "CPUs": 8, "DiskSize": 2146435072, "Memory": 603856896 }, "SSHConfig": { "IdentityPath": "C:\Users\f.lorenzo.gomis\.ssh\podman-machine-default", "Port": 57957, "RemoteUsername": "user" }, "State": "running", "UserModeNetworking": false } ]
What can I do?
Anyone hitting this same issue on MacOS Sonoma running Docker - the same applies.
I ran docker context list
, which gave me my endpoints. I then set DOCKER_HOST to an endpoint listed (I had 2 different listed, so I tested with both) - unix:///Users/[my username]/.docker/run/docker.sock
and ran it again.
This worked for me.
@jamesmhaley Thanks for the solution. Setting DOCKER_HOST
to (unix:///Users/[my username]/.docker/run/docker.sock
) worked for me when running trivy as a standalone app.
Although when running trivy inside docker, weirdly, the sock volume path to be mounted was the default one, as opposed to the one mentioned above.
I'm having hte same problem, when running the helm chart in a EKS cluster:
scan error: unable to initialize a docker scanner: 3 errors occurred:
* unable to inspect the image (748960220740.dkr.ecr.eu-west-1.amazonaws.com/gitaws:py3.11-2024-02-29c): 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://748960220740.dkr.ecr.eu-west-1.amazonaws.com/v2/gitaws/manifests/py3.11-2024-02-29c: unexpected status code 401 Unauthorized: Not Authorized
How do I set the DOCKER_HOST
variable?
I've installed Trivy in this way:
helm repo add aqua https://aquasecurity.github.io/helm-charts/
helm repo update
helm install trivy-operator aqua/trivy-operator \
--namespace trivy-system \
--create-namespace \
--set="trivy.ignoreUnfixed=true" \
--version v0.0.3
Hi @knqyf263 , is there a specific reason why we expect podman.socket to be active, cos podman by default does not expect podman.socket or podman.service to be active if I am not wrong. Wondering if we can directly utilize podman/libpod https://github.com/containers/podman .
We seem to need inspect, history and save commands, and none of them mandatorily require podman.socket or podman.service if I am not wrong.
@namandf We used to try the library. It has too many dependencies, and cross-compilation failed due to that (I forgot, but it was probably due to CGO). That was a few years ago, so things may be different now.
Description
MacBook M1 user is experiencing the Podman Socket error when trying to scan for locally built images. When she tries to scan a image that is pulled from the web, Trivy works just fine.
What did you expect to happen?
Trivy scans the image and reports for vulnerabilities normally.
What happened instead?
Output of run with
-debug
:Output of
trivy -v
:Additional details (base image name, container registry info...):
I noticed that other users that are using MacBooks with Intel chips are not experiencing this problem.