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.83k stars 278 forks source link

[Enhancement]: Extending Testcontainers to support multiple container runtimes (Podman) #876

Open HofmeisterAn opened 1 year ago

HofmeisterAn commented 1 year ago

Problem

Since Testcontainers for Node has done an awesome job supporting multiple container runtimes (not just Docker), it makes perfect sense to continue this great work and look into implementing it for .NET. We can start by collecting a list of tasks, issues or incompabilities that are necessary to support other runtimes as well.

Solution

-

Benefit

-

Alternatives

-

Would you like to help contributing this enhancement?

Yes

tebeco commented 9 months ago

Context: Apple MacBook Pro M3 - ARM Podman installed

might be a pre-requisite:

brew update
brew upgrade

# this is because QEMU had a bug since mid december / january that pulled an x86 image on ARM
# this is likely fixed and force a full re-creation
podman machine stop
podman machine rm
podman machine init

podman machine start

All I had to do was:

$ echo "ryuk.container.privileged = true" >> $HOME/.testcontainers.properties
$ cat $HOME/.testcontainers.properties

ryuk.container.privileged = true
$

and from podman Dashboard enable Docker compatibility:

image
kanpov commented 5 months ago

I've tried using Testcontainers with Podman via a simple ln /run/user/1000/podman/podman.sock /run/user/1000/docker.sock and so far it works exactly as well as with Docker, so are the issues only related to tests or are there any functional hindrances?

HofmeisterAn commented 5 months ago

so are the issues only related to tests or are there any functional hindrances?

The issues are not just related to the tests in this repository. Depending on your Podman environment and configuration, they can happen their as well.

tebeco commented 3 months ago

should this still be opened @HofmeisterAn ?

since qemu fixed their image

HofmeisterAn commented 3 months ago

I'm not sure, but in my opinion, we should keep the issue open until we have a working GitHub workflow that supports Podman. I haven't recently tested TC for .NET with Podman, I don't know which features are working and which are not.

tebeco commented 3 months ago

i fail to understand the relation between "testcontainer works with podman"✅ versus "adding a github workflow integration feature (to testcontainer withpod man")⚒️

that second one seems like an integration evol one that needs to be created as "proposal" while the second one seems working (this ticket)

HofmeisterAn commented 3 months ago

I think there are still a few issues that prevent Testcontainers for .NET from working properly with Podman, or at least obstacles. Ideally, this issue addresses the Podman incompatibilities (failing tests) and establishes a proper GH workflow (incl. updating the docs and explain which steps are necessary to set it up). Otherwise, we cannot know which features are working, which are not, and which may break with newer versions.

tebeco commented 3 months ago

/remindme 1year

🙃 (bad joke ok ...)

mdx0111 commented 2 months ago

To get it working on Fedora 40, I ran the following command echo "ryuk.container.privileged = true" >> $HOME/.testcontainers.properties

Then ran this ln /run/user/1000/podman/podman.sock /run/user/1000/docker.sock

And everything started working nicely.

serezlan commented 2 months ago

Hi,

I'm facing problem when I create network with TC.

Steps too reproduce:

Result: Docker.DotNet.DockerApiException : Docker API responded with status code=InternalServerError, response={"cause":"CNI network \"1ddde97e-1272-4bf4-82c3-4998f4ab8c08\" not found","message":"error configuring network namespace for container aaeba79b34ab9de814ea4fa586696d507d72d47fd566c147748321f7a1285873: CNI network \"1ddde97e-1272-4bf4-82c3-4998f4ab8c08\" not found","response":500}

Environment: TC version : 3.10.0 dotnet 8 debian 12

I'm not sure if this is podman or TC issue. Please let me know if I need to make changes.

serezlan commented 2 months ago

apparently the default podman version in my distro is quite old (v3) I upgrade to v4.3.1 and I got it working.

thx :)