Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Support get local image by containerd #348

Merged
merged 50 commits into from
Jun 12, 2022

Conversation

mowangdk
Copy link
Contributor

@mowangdk mowangdk commented Dec 22, 2021

Fix aquasecurity/trivy#851

done:
code develop
e2e test
image

Current state:
add unit test

@mowangdk mowangdk force-pushed the support_containerd_daemon branch 4 times, most recently from 2e1742a to ea1b60c Compare December 28, 2021 08:45
@mowangdk mowangdk force-pushed the support_containerd_daemon branch 6 times, most recently from 28d03c5 to 58fe5c7 Compare January 5, 2022 03:38
@mowangdk
Copy link
Contributor Author

mowangdk commented Jan 5, 2022

@knqyf263 e2e test passed, i need write unit test for containerd daemon, should i add code on this project? https://github.com/aquasecurity/testdocker

@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 5, 2022

@mowangdk Yes, it would be great. You can create a new directory containerd or something like that.

@mowangdk
Copy link
Contributor Author

@knqyf263 i wonder if there is any other ways to complete auto tests such as add test case in e2e tests? Because containerd official repo does not provide any mock interfaces. there are many interfaces need to mock which requires a lot of work

@mowangdk
Copy link
Contributor Author

@knqyf263 I'll keep writing the mock interface if there's no other way, but it takes a long time。。

@knqyf263
Copy link
Collaborator

Can we emulate containerd only for necessary APIs?

@mowangdk
Copy link
Contributor Author

Can we emulate containerd only for necessary APIs?

@knqyf263 I was intent to do this, but containerd is designed with a complex interface and it is incompatible with the docker. So i am going to create an interface on the client side to wrap all the methods provided by containerd. mock these method on the new interface

@knqyf263
Copy link
Collaborator

Is there any tool supporting containerd? We may want to see how those tools test communication with containerd.

@mowangdk
Copy link
Contributor Author

Is there any tool supporting containerd? We may want to see how those tools test communication with containerd.

I have checked cri and pouch. Neither project provides an containerd openapi for simulation.

@knqyf263
Copy link
Collaborator

How do they test containerd?

@mowangdk
Copy link
Contributor Author

How do they test containerd?
@knqyf263 pouch itself does not provide containerd related unittest, and cri does so in the way I mentioned above~

@knqyf263
Copy link
Collaborator

knqyf263 commented Jan 23, 2022

What if we give up unit tests and focus on integration tests? We may want to run containerd as a container as follows.
https://github.com/westonsteimel/container-library-containerd/pkgs/container/containerd

Also, you can refer to this Dockerfile.
https://github.com/containerd/nerdctl/blob/1e0afeb8067dd85d18b7b2d3554dd71aba45dc02/Dockerfile#L52-L66

@mowangdk
Copy link
Contributor Author

What if we give up unit tests and focus on integration tests? We may want to run containerd as a container as follows. https://github.com/westonsteimel/container-library-containerd/pkgs/container/containerd

Also, you can refer to this Dockerfile. https://github.com/containerd/nerdctl/blob/1e0afeb8067dd85d18b7b2d3554dd71aba45dc02/Dockerfile#L52-L66

gotcha, I think this is a better way, I will refer to the integration/ examples to complete the integration test

@knqyf263
Copy link
Collaborator

Thanks for your efforts.

@mowangdk
Copy link
Contributor Author

mowangdk commented Jan 26, 2022

Thanks for your efforts.

ur welcome~

@sbx0r
Copy link

sbx0r commented Jan 26, 2022

Hello Guys.
Any update on that? :)

@mowangdk
Copy link
Contributor Author

mowangdk commented Feb 2, 2022

Hello Guys. Any update on that? :)

not finish yet, in the process of writing integration tests

@mowangdk
Copy link
Contributor Author

mowangdk commented Feb 2, 2022

@knqyf263 I have encountered a new problem, please advise how to solve. i can't access the socket path outside the container (the path is already shared)

docker inspect result:
image

no response from host access
image

This issue prevents me from using testcontainer to access containerd,containerd will throws this error
image

@knqyf263
Copy link
Collaborator

knqyf263 commented Feb 2, 2022

image/daemon.go Outdated
Comment on lines 14 to 15
defaultContainerdSocket = "/run/containerd/containerd.sock"
defaultContainerdNamespace = "default"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values should be in containerd.go.

@mowangdk
Copy link
Contributor Author

Sorry, I've been busy with work lately. unable to follow up in time 😭

@knqyf263 knqyf263 merged commit 981bf73 into aquasecurity:main Jun 12, 2022
@knqyf263
Copy link
Collaborator

@mowangdk Thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scan host images running containerd
5 participants