Open joeg-ita opened 2 months ago
am planning on fixing in #622
This should also come with documentation on how to setup a working CI pipeline on Gitlab and Github.
Git hub is easy, it does not require dind
On Tue, Jul 16, 2024, 7:05 PM Thomas Lutz @.***> wrote:
This should also come with documentation on how to setup a working CI pipeline on Gitlab and Github.
— Reply to this email directly, view it on GitHub https://github.com/testcontainers/testcontainers-python/issues/644#issuecomment-2231958513, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACECGJA33YMVZKRT54KPA5TZMWRLDAVCNFSM6AAAAABKUPDO5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRHE2TQNJRGM . You are receiving this because you commented.Message ID: @.***>
It looks like this was introduced in https://github.com/testcontainers/testcontainers-python/pull/388 @kiview this change sadly broke our setup I think - can't we find a way to support both?
It essentially prevents all docker in docker use cases from what I see.
We were impacted by this as well, costed us almost 2 days 👎 Solution was to go back to testcontainers 3.7.*, not a nice solution but it works at least.
@alexanderankin We are not using "dind" on a private hosted GitLab/Runner and it still doesnt work. Our runner does run in Docker, with "host" network and "/var/run/docker.sock" access. This used to work fine in v3.x hasnt work since 4.x.
I'm also using testcontainers-go, and that one works fine, it's something with this package.
For me, it works like this (in a Gitlab Runner):
my-job:
variables:
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/docker.sock"
TESTCONTAINERS_RYUK_DISABLED: true
This workaround worked for us in github runner (it works well with ryuk being enabled):
from testcontainers.core.container import DockerContainer
def fixed_get_container_host_ip(self) -> str:
host = self.get_docker_client().host() or "localhost"
if inside_container() and not os.getenv("DOCKER_HOST") and not host.startswith("http://"):
gateway_ip = self.get_docker_client().gateway_ip(self._container.id)
if gateway_ip == host:
return self.get_docker_client().bridge_ip(self._container.id)
return gateway_ip
return host
DockerContainer.get_container_host_ip = fixed_get_container_host_ip
# run your testcontainer afterwards
method get_container_host_ip(self) in testcontainers/core/container.py
have the following code commented (you drive me crazy) and should be uncommented