Skip to content

Bug: Testcontainers in Docker container #644

Open

Description

method get_container_host_ip(self) in testcontainers/core/container.py

have the following code commented (you drive me crazy) and should be uncommented

    # # check testcontainers itself runs inside docker container
    # if inside_container() and not os.getenv("DOCKER_HOST") and not host.startswith("http://"):
    #     # If newly spawned container's gateway IP address from the docker
    #     # "bridge" network is equal to detected host address, we should use
    #     # container IP address, otherwise fall back to detected host
    #     # address. Even it's inside container, we need to double check,
    #     # because docker host might be set to docker:dind, usually in CI/CD environment
    #     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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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