Skip to content
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

Re-use existing networks #527

Closed
fdw opened this issue Jul 29, 2022 · 2 comments
Closed

Re-use existing networks #527

fdw opened this issue Jul 29, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@fdw
Copy link

fdw commented Jul 29, 2022

Is your feature request related to a problem? Please describe.
For complicated reasons, our tests already run in a Docker container. From there, we want to use testcontainers to start a sibling container.
While this works fine, we need to connect both to the same network so that the testcontainer is reachable. Unfortunately, as far as we can see, we can only connect it to an existing network if we know the network's ID (which we don't, as it is re-created regularly).

Describe the solution you'd like
It should be possible to connect a testcontainer to a network using only the network's name.

Describe alternatives you've considered
It might be possible to use some other Docker library to find the ID of the network so that we can pass it to testcontainers. But that is a lot of work.

@HofmeisterAn
Copy link
Collaborator

This is not yet supported and relates to #506#407 too. I haven't thought much about alternatives, but I think we need something similar. Maybe we can use the AbstractBuilder to provide this feature for all Docker resources.

@HofmeisterAn HofmeisterAn added enhancement New feature or request help wanted Extra attention is needed labels Jul 29, 2022
@HofmeisterAn
Copy link
Collaborator

Since we refactored and moved to the new container builder API, this is now possible. You can use WithNetwork(string) to connect to an already existing network. In addition, we extended the reuse support by implementing #1051.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants