You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exposing bridged ip address to facilitate container to container communcation? #74
I saw that there is a method called get_container_host_ip that returns the container's ip depending on if it's in a container or not. I didn't see a way to actually get the bridge ip address of a specific container. The use case that I have is that I have a python integration test that runs localstack container that needs to communicate with multiple containers, one being a database. My localstack container runs a lambda that gets passed an environment variable that says where the database is located. If i use get_container_host_ip to pass the ip to the lambda, it always returns localhost because the python tests are running locally on my machine.
Possible workarounds are running my tests inside of a container so that it never uses localhost. I saw the testcontainers for java has the ability to set the network and so you can use a network alias to communicate between the containers which you can't use when using the bridged network. Another workaround is to just expose a function that returns the bridged IP on the DockerContainer class, but that seems like a hack.
Activity
tillahoffmann commentedon Apr 28, 2020
@SwagMuffinMcYoloPants, do the changes @tuvshuud introduced in #85 address your needs?
SwagMuffinMcYoloPants commentedon May 1, 2020
Sorry for the delayed response. Looking at it over quickly, it looks like it would. I double check over the weekend.
SwagMuffinMcYoloPants commentedon May 8, 2020
Hi. I'm so sorry for the delayed response. It looks like this addresses my use case. I appreciate the speedy response!