testcontainers / testcontainers/testcontainers-python

Bug: Testcontainers in Docker container

Open
#644 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.3k
Forks
386
Avg merge
4h 40m
Merged PRs (30d)
1

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in testcontainers/core/container.py at get_container_host_ip(self) and read the surrounding host-detection logic and commented Docker-in-Docker branch. Check existing tests for container host resolution, then verify the branch is active and the expected host or bridge IP behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.