-
Notifications
You must be signed in to change notification settings - Fork 297
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
Bug: Testcontainers can't connect to set DOCKER_HOST in Gitlab CI #653
Comments
several things to note about versions:
|
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 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
.The text was updated successfully, but these errors were encountered: