Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom docker socket for image scan option #2997

Closed
aswath-s-tw opened this issue Oct 6, 2022 · 17 comments · Fixed by #3599
Closed

custom docker socket for image scan option #2997

aswath-s-tw opened this issue Oct 6, 2022 · 17 comments · Fixed by #3599
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Milestone

Comments

@aswath-s-tw
Copy link
Contributor

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>.

@aswath-s-tw aswath-s-tw added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 6, 2022
@aswath-s-tw
Copy link
Contributor Author

hey trivy team, please do review this request. Would like to work on it !

@titanventura
Copy link

Hey trivy team. Is this feature request even valid ? Please validate it so that I can start working on a solution.

@lme-nca
Copy link

lme-nca commented Nov 3, 2022

Bumping this point, would like this option! additionally trivy should maybe always check for the colima socket, just like it does for podman etc....

@aswath-s-tw
Copy link
Contributor Author

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 !

@lme-nca
Copy link

lme-nca commented Nov 4, 2022

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 :)

@github-actions
Copy link

github-actions bot commented Jan 4, 2023

This issue is stale because it has been labeled with inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed. label Jan 4, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2023
@knqyf263 knqyf263 reopened this Jan 25, 2023
@knqyf263 knqyf263 removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed. label Jan 25, 2023
@knqyf263
Copy link
Collaborator

I think DOCKER_HOST helps, but it sounds reasonable to add a flag.

@knqyf263 knqyf263 added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Jan 25, 2023
@aswath-s-tw
Copy link
Contributor Author

In that case, I would like to work on it. Can you assign me to this issue ?

@knqyf263
Copy link
Collaborator

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.

@aswath-s-tw
Copy link
Contributor Author

aswath-s-tw commented Jan 29, 2023

Hi, Can i load --docker-host as a field in the struct DockerOption located in pkg/fanal/types/docker.go

@aswath-s-tw
Copy link
Contributor Author

aswath-s-tw commented Feb 1, 2023

Hi @AndreyLevchenko , if this approach is fine, I can go ahead with the implementation. Wanted to follow up. What do you think ?

@aswath-s-tw
Copy link
Contributor Author

ping @AndreyLevchenko @knqyf263

1 similar comment
@aswath-s-tw
Copy link
Contributor Author

ping @AndreyLevchenko @knqyf263

@knqyf263
Copy link
Collaborator

knqyf263 commented Feb 5, 2023

Sounds good

@aswath-s-tw
Copy link
Contributor Author

aswath-s-tw commented Feb 9, 2023

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 !

@AndreyLevchenko
Copy link
Contributor

Hi @aswath-s-tw
Could you publish PR draft so we could review your code and suggest something related to tests

@aswath-s-tw
Copy link
Contributor Author

aswath-s-tw commented Feb 12, 2023

Hey @knqyf263 @AndreyLevchenko please review the code/PR and suggest changes if any. Thanks !

aswath-s-tw added a commit to aswath-s-tw/trivy that referenced this issue Feb 12, 2023
@knqyf263 knqyf263 added this to the v0.38.0 milestone Feb 13, 2023
aswath-s-tw added a commit to aswath-s-tw/trivy that referenced this issue Feb 14, 2023
aswath-s-tw added a commit to aswath-s-tw/trivy that referenced this issue Feb 16, 2023
aswath-s-tw added a commit to aswath-s-tw/trivy that referenced this issue Feb 16, 2023
@knqyf263 knqyf263 modified the milestones: v0.38.0, v0.39.0 Mar 1, 2023
@knqyf263 knqyf263 modified the milestones: v0.39.0, v0.40.0 Apr 3, 2023
aswath-s-tw added a commit to aswath-s-tw/trivy that referenced this issue Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants