Closed claussa closed 3 months ago
this has not worked since #388 - i do not know how to test it so it has not been reverted in any meaningful way but you can discover more of these threads about the dind issue here #517 including, ultimately the workaround - https://github.com/testcontainers/testcontainers-python/issues/475#issuecomment-2040182302
I do think this project should fix itself but im going to close this issue because i dont think it differs from the other issues. feel free to correct if this is not the case.
Describe the bug
My test does not work:
To Reproduce
Run your test on linux in a container while mounting
/var/run/docker. sock
without specifyingDOCKER_HOST
.Runtime environment
Docker image:
python:3.10
Testcontainers version:4.4.0
Source of the bug
Reaper._container.get_container_host_ip()
does not return the correct value.In
docker_client.py
:This method return
localhost
because the client api base_url ishttp+docker://localhost/v1.41/containers/create
So the first condition is true, and the method returnlocalhost
.It should test if we are inside a container and if true, get the
default_gateway_ip()
.Furthermore this method so throw an error if the subprocess return an error. For now, it just return
None
if the commandip
is not installed.Last weird comportement in
get_exposed_port
:I don't understand the condition if we are inside a container, if the host is the same as the gateway ip we should return the mapped_port. In this case, we are in a container, so using the gateway_ip as host we should use the mapped_port to connect to the mapped port on the host.