testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.66k stars 253 forks source link

[Enhancement]: Support nerdctl and docker commands #819

Open kieronlanning opened 1 year ago

kieronlanning commented 1 year ago

Problem

Unable to use testcontainers when using nerdctl.

Tools such as Rancher Desktop allow you to choose between docker and nerdctl.

Solution

Support the nerdctl or docker command. The CLI command structures are identical to support compatibility.

Either through configuration or auto-detection (preferred) to allow developers running different local setups to still be able to run tests.

Benefit

Supports a wider range of developers.

Alternatives

N/A

Would you like to help contributing this enhancement?

Yes

HofmeisterAn commented 1 year ago

The CLI command structures are identical to support compatibility.

Do you know if nerdctl is Docker Engine API compatible? Testcontainers does not use the CLI implementation of Docker. It relies on Docker's Engine API.

kieronlanning commented 1 year ago

@HofmeisterAn I don't believe so... however, there are projects that bridge both:

https://github.com/afbjorklund/nerdctld found via https://github.com/containerd/nerdctl/issues/798

HofmeisterAn commented 1 year ago

Okay, this sounds similar to Podman support. I think the Podman developers use TC to test their API compatibility. Maybe that makes sense for nerdctl too. I am happy to continue with nerdctl support as soon as it is compatible.

kieronlanning commented 1 year ago

Wicked, thankyou.