testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
7.97k stars 1.64k forks source link

[Enhancement]: Add ability to supply network to ryuk container #8167

Open vkravets opened 7 months ago

vkravets commented 7 months ago

Module

Core

Synopsis

This is required due to one aspect of rootless podman networking:

https://docs.podman.io/en/latest/markdown/podman-run.1.html#network-mode-net

Screenshot 2024-01-29 at 20 44 31

This implies that network is not picked up when runnig podman in rooless mode thus making it impossible for ryuk to communicate with other containers even if they were started with --network=bridge network

Proposal

Tescontainer can run using custom network (auto created via Network.createNetwork() or external) and ryuk in this case cannot be customized to use the same custom network. Some environmet can have restrictions on default network, or even have different access to each other. In this case ryuk could not see the containers at all.

Since Testcontainer already has custom env varible to override some functionality will be great to have custom varible to define:

Workaround in this case disable ryuk only.

ChaosWars commented 3 months ago

This would also help on VSCode devcontainers. Currently the only way to solve this issue is to disable ryuk and calling .withNetworkMode(network), supplying the devcontainer bridge network as the parameter.

kiview commented 3 months ago

@ChaosWars Can you please elaborate on the devcontainer issue? Wouldn't the devcontainer run using Docker socket mounting, so having Testcontainers containers as sibling containers?

@vkravets As of now, we don't intend to add Podman-specific changes to the project, but we have good experiences with opening such topics up with the Podman project, since they generally want to get closer to the drop-in Docker replacement claim, and this is clearly a difference in behavior.