-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
[Feature] Add withAccessToHost option to access to host from containers #2212
Comments
+1 for this one that is crucial for a helper container (think of a dev service/tooling) that needs to access the application under development that runs locally. We'll also probably need the equivalent of |
Hi, we have internally discussed this issue, and because it's already available in Java, and handy for testing, we are going to work on it. It basically needs to start an SSHD container to forward the traffic to it, as seen in https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/containers/PortForwardingContainer.java |
Thanks, in my case, it is helpful as I use testcontainers-k3s in pod callback scenarios to external services. There is some unreliability using |
Hi, if I understand this correctly, is the goal to export a port from the container to host so that the container can access it? If so, is there a solution for the reverse scenario? Specifically, I've spun up a container and would like to expose ports from the host to the running container so that I can access them from the host. The problem I'm attempting to address is related to spinning up a Redis cluster using the Testcontainers library. I'm concerned that if I start the Redis cluster with all nodes together and export the ports before the container starts, there might be issues. I'm unsure if Testcontainers will occupy the ports in advance, potentially preventing other processes from using them. My assumption is that there's a small chance the exposed ports might be utilized by other processes or containers, given that the container requires around 20 seconds to start up and we are using shared hosts for spinning up containers. Therefore, I'm exploring the possibility of spinning up Redis nodes one by one and bootstrapping them into a cluster. However, to accomplish this, we need a method to dynamically expose ports for each newly created Redis node inside the running container. This is the current constructor to spin up a Reids cluster with all nodes together. addFixedExposedPort doesn't work after the container is running.
Really appreciate if anyone could help here, thanks! |
Hey folks, I'm adding #2471 as draft for feedback 🙏 I'm currently multitasking and would love to check with you if the implementation would be usable from your side. Please read the follow-up notes. Thanks! |
Problem
In my case, I've a container that needs to access to host in order to function.
Solution
Add the
withAccessToHost(bool: access)
from Java implem to Go to do that.Benefit
The main advantage is to allow containers to communicate with the host.
(e.g. Redis hosted on a host or a service under development, etc.)
Alternatives
IDK
Would you like to help contributing this feature?
Yes
The text was updated successfully, but these errors were encountered: