Skip to content
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: Docker environment variables are ignored in 4.2 and 4.3 when host is set #521

Closed
sku-0001 opened this issue Apr 2, 2024 · 5 comments · Fixed by #524 or #522
Closed

Bug: Docker environment variables are ignored in 4.2 and 4.3 when host is set #521

sku-0001 opened this issue Apr 2, 2024 · 5 comments · Fixed by #524 or #522

Comments

@sku-0001
Copy link

sku-0001 commented Apr 2, 2024

Describe the bug

Expected to be able to set the following environment variables:

DOCKER_HOST="https://docker:2376"
DOCKER_TLS_VERIFY=1
DOCKER_TLS_CERTDIR="/certs"
DOCKER_CERT_PATH="/certs/client"

After setting these, only DOCKER_HOST is read and applied, other TLS configuration is ignored.

To Reproduce

Try to set up a TLS based docker setup locally with the provided variables in the description.

Runtime environment

This was tested in gitlab kubernetes dind runner environment, but looking at the code this should not matter.
OS: Ubuntu 22.04 LTS
Python: 3.10.12
Testcontainers: 4.2 and 4.3 tested and failed, 4.1.2 works

@sku-0001
Copy link
Author

sku-0001 commented Apr 2, 2024

Mostly related to the code here

@alexanderankin
Copy link
Collaborator

alexanderankin commented Apr 2, 2024

@sku-0001 can you give https://pypi.org/project/testcontainers/4.3.1rc1/ a try? thanks!!!

actually that one also has a bug, but then it is doubly curious for me if it works for you - latest is on the branch:

pip install git+https://github.com/testcontainers/testcontainers-python.git@fix_no_more_from_env

@sku-0001
Copy link
Author

sku-0001 commented Apr 2, 2024

Hello, thanks for the quick response.
I tried out the 4.3.1rc1 and got the following error:

.venv/lib/python3.10/site-packages/docker/client.py", line 99, in from_env
    **kwargs_from_env(**kwargs)
TypeError: kwargs_from_env() got an unexpected keyword argument 'base_url'

The base url could also be wrong in our internal django testcontainers runner library so take this with a grain of salt 😄

Also tried the fix_no_more_from_env branch and it works without any modifications 👍

Hopefully this helps.

@alexanderankin
Copy link
Collaborator

thanks for the quick feedback. going to release the fix for the branch shortly and yank the rc. i always seem to miss the mark with those 🙃

alexanderankin pushed a commit that referenced this issue Apr 2, 2024
🤖 I have created a release *beep* *boop*
---


##
[4.3.1](testcontainers-v4.3.0...testcontainers-v4.3.1)
(2024-04-02)


### Bug Fixes

* **core:** env vars not being respected due to constructor call
([#524](#524))
([4872ea5](4872ea5)),
closes
[#521](#521)
* Pin MongoDB images and improve test coverage for maintained versions
([#448](#448))
([b5c7a1b](b5c7a1b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@alexanderankin
Copy link
Collaborator

@sku-0001 sorry i got distracted earlier - 4.3.1 is out now, containing the fix you tested on the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants