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
Bug: K3SContainer does not support other connection modes (in get_container_host_ip) #861
K3SContainer calls get_container_host_ip in its __init__ method here and here before the container is started, causing it to fail with an AssertionErrorhere.
To Reproduce
fromtestcontainers.k3simportK3SContainerwithK3SContainer() ask3s:
print("gonna throw an error before I even get here :(")
Runtime environment
I'm on an ARM Mac and this is in Python 3.12, but that shouldn't make a difference.
oh, seems like we have to re-think container modes - or k3s - the new
container modes that try to help address dind/dood are not compatible with
the k3s container. ill move the assert inside the if branches that need it,
and then it will work by default (not dind or dood or whatever0
the fact that k3scontainer does not support other connection modes is not an issue with the core library, thats an issue with the community module. PR's welcome. before we introduced this change, this should have never worked with dind in the first place - connection modes allow for use of gateway_ip specifically. so in this case you can set the connection mode to docker_host and see if that works, otherwise we have to think together about how to solve this - getting the container's private ip before it exists - dont think this is possible. I believe the earlier behavior was just using connection mode = docker host
changed the title [-]Bug: `K3SContainer` calls `get_container_host_ip` in constructor before container is started[/-][+]Bug: `K3SContainer` does not support DinD (in `get_container_host_ip`)[/+]on Sep 11, 2025
changed the title [-]Bug: `K3SContainer` does not support DinD (in `get_container_host_ip`)[/-][+]Bug: `K3SContainer` does not support other connection modes (in `get_container_host_ip`)[/+]on Sep 11, 2025
Activity
alexanderankin commentedon Aug 13, 2025
alexanderankin commentedon Aug 13, 2025
alexanderankin commentedon Aug 14, 2025
#862
marbon87 commentedon Sep 11, 2025
Still having the same error with 4.13.0:
alexanderankin commentedon Sep 11, 2025
the fact that k3scontainer does not support other connection modes is not an issue with the core library, thats an issue with the community module. PR's welcome. before we introduced this change, this should have never worked with dind in the first place - connection modes allow for use of gateway_ip specifically. so in this case you can set the connection mode to docker_host and see if that works, otherwise we have to think together about how to solve this - getting the container's private ip before it exists - dont think this is possible. I believe the earlier behavior was just using connection mode = docker host
[-]Bug: `K3SContainer` calls `get_container_host_ip` in constructor before container is started[/-][+]Bug: `K3SContainer` does not support DinD (in `get_container_host_ip`)[/+][-]Bug: `K3SContainer` does not support DinD (in `get_container_host_ip`)[/-][+]Bug: `K3SContainer` does not support other connection modes (in `get_container_host_ip`)[/+]marbon87 commentedon Sep 12, 2025
Hi @alexanderankin ,
setting the conncetion-mode to docker_host with
does solve the problem.