Skip to content

Question: Should ComposeContainer in Testcontainers Python expose container info like in Java? #857

Description

@VictorCavichioli

What are you trying to do?

Hello! I've been using Testcontainers for Java, and we recently started using it for Python as well. I noticed that in Java, when you have a Docker Compose setup and retrieve a container by its service name, it's possible to use getContainerInfo (which we use in our Java projects), and with this method, I can see networks and their details, among other things.

I noticed that in Testcontainers for Python, the Docker Compose support doesn’t offer this. When I get a container from a compose setup by its service name, it returns a ComposeContainer, and this ComposeContainer doesn't provide as much information as the Java version. So, I have a few questions:

Is there an architectural decision in the Python project not to include this? For example, is it considered out of scope or something similar?

Is there any on going work to implement something similar?

Would this feature be well received by the community if it were implemented?

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.

Paste the results of the bash below

uname -a
echo "------"
docker info
echo "------"
poetry run python --version
echo "------"
poetry show --tree
paste-me-here

Activity

  1. VictorCavichioli commented on Aug 25, 2025

    @VictorCavichioli
    ContributorAuthor

    Hi @alexanderankin would it be useful? I can work on this

  2. alexanderankin commented on Sep 23, 2025

    @alexanderankin
    Member

    PR is welcome to make it better.

  3. VictorCavichioli commented on Oct 6, 2025

    @VictorCavichioli
    ContributorAuthor

    Hi @alexanderankin, I created this PR #897 based on what I see in the java implementation

  4. VictorCavichioli commented on Apr 10, 2026

    @VictorCavichioli
    ContributorAuthor

    PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions