trivy
trivy copied to clipboard
custom docker socket for image scan option
It would be great if we can have a flag for scanning local images with custom docker socket path.
I use colima as the container runtime for docker. The unix domain socket path for colima is unix:///Users/<username>/.colima/default/docker.sock
while doing trivy image <image_name>
, it throws an error saying Cannot connect to the Docker daemon at unix:///var/run/docker.sock
. Would be cool if it had an option similar to trivy image --socket <socket_path>
.
hey trivy team, please do review this request. Would like to work on it !
Hey trivy team. Is this feature request even valid ? Please validate it so that I can start working on a solution.
Bumping this point, would like this option! additionally trivy should maybe always check for the colima socket, just like it does for podman etc....
Ahh ! Never mind about this issue ! It is easily possible in colima too if we are able to create a symbolic link between the colima socket file and the docker sock path.
I ran sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
and it worked fine !
Thanks for the support anyway. Please let me know if other container runtimes need to be supported. Would be happy to help !
Yes this works as well, however sadly i'm on a managed machine and this involves me getting the sudo permission first, which is rather cumbersome :)
This issue is stale because it has been labeled with inactivity.
I think DOCKER_HOST
helps, but it sounds reasonable to add a flag.
In that case, I would like to work on it. Can you assign me to this issue ?
In that case, I would like to work on it. Can you assign me to this issue ?
Sure! @AndreyLevchenko will help. I think we want to add --docker-host
.
Hi, Can i load --docker-host
as a field in the struct DockerOption
located in pkg/fanal/types/docker.go
Hi @AndreyLevchenko , if this approach is fine, I can go ahead with the implementation. Wanted to follow up. What do you think ?
ping @AndreyLevchenko @knqyf263
ping @AndreyLevchenko @knqyf263
Sounds good
Hi @knqyf263 can I get some ideas or pointers around how I should write tests for this feature ? I seem to have done the implementation bit. But was not sure what to test and how to structure my tests !
Hi @aswath-s-tw Could you publish PR draft so we could review your code and suggest something related to tests
Hey @knqyf263 @AndreyLevchenko please review the code/PR and suggest changes if any. Thanks !