-
Notifications
You must be signed in to change notification settings - Fork 126
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
containerIpAddress returns the gateway #15
Comments
Hi @miketwo, |
@miketwo it seems (per testcontainers/testcontainers-java#654) this was fixed in testcontainers-java 1.7.1 so it will be available in testcontainers-scala 0.17.0 |
Hmmm... maybe. That fix looks like it's for |
The call to
container.containerIpAddress
seems to return the gateway instead of the container's ip address.Working example (this is modified from the docs):
It should return something like:
To see the actual network settings, I ran
docker network inspect <MAIN BRIDGE ID>
while the test was running. The outputs looked like this:The workaround seems to be using
container.containerInfo.getNetworkSettings.getIpAddress
, but this method is marked as deprecated, so I'm worried about relying on it. I thinkcontainerIpAddress
should return the v6IP if available, and the v4IP if not.It's worth noting that I ran this test from within another docker container with
-v /var/run/docker.sock:/var/run/docker.sock
mounted so that I can create sibling containers.The text was updated successfully, but these errors were encountered: