Closed spreeni closed 1 month ago
several things to note about versions:
testcontainers-core
is an orphaned package - its essentially 4.0.0-rc* (as are testcontainers-mysql
etc, use testcontainers[mysql]
instead) - we publish to testcontainers
regularly (although I am having less and less time to publish i can still accept PRs and release those in that package. - https://pypi.org/project/testcontainers/Thanks for the super-fast answer! Those are some good infos, thanks for providing them. I tried it with 3.7.1, but had the same issue. I have a gut feeling that this is something in the Gitlab runner set up by our sysadmins.
For now I will test locally with testcontainers
, but maybe I will have to move to running Opensearch as a general service for the CI/CD pipeline then.
Hope Gitlab CI/CD support will come in the future - would love to use it in the pipeline.
if you absolutely need it then you just override the function to get the port to detect if you are inside the container and use the port instead of the forwarded port (and couple other gotchas if you are using custom networks, etc) - but in general yes this is not supported yet. there are some people using it but the setups are apparently different. I don't have access to an environment where i'd need something like that.
@spreeni It's not your runner. Testcontainers changed how they detect docker and it no longer works since 4.x.x
Describe the bug
I can't get testcontainers to run in my Gitlab CI/CD pipeline, despite following the
docker:dind
setup, settingDOCKER_HOST="tcp://docker:2375"
andDOCKER_TLS_CERTDIR=""
(see https://java.testcontainers.org/supported_docker_environment/continuous_integration/gitlab_ci/ or https://samanta-reinosoa.medium.com/testing-fastapi-with-testcontainers-in-gitlab-b7c62068aeef).testcontainers seems to be unable to connect to the specified docker host, I am getting the error
docker.errors.DockerException: Error while fetching server API version: HTTPConnectionPool(host='docker', port=2375): Max retries exceeded with url: /version (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f102d2cd8d0>: Failed to resolve 'docker' ([Errno -2] Name or service not known)"))
To Reproduce Below my
.gitlab-ci.yml
:Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of
testcontainers-python
you are using? You can run the following commands to get the relevant information.I am using
testcontainers-core==0.0.1rc1
.