Skip to content

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

Closed

Description

@sku-0001

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

Activity

  1. sku-0001 commented on Apr 2, 2024

    @sku-0001
    Author

    Mostly related to the code here

  2. alexanderankin commented on Apr 2, 2024

    @alexanderankin
    Member

    @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
    
  3. sku-0001 commented on Apr 2, 2024

    @sku-0001
    Author

    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.

  4. alexanderankin commented on Apr 2, 2024

    @alexanderankin
    Member

    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 🙃

  5. added 2 commits that reference this issue on Apr 2, 2024
    4872ea5
    0fb4aef
  6. alexanderankin commented on Apr 2, 2024

    @alexanderankin
    Member

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions