testcontainers / testcontainers/testcontainers-python

Feature: Allow setting environment variables with DockerCompose

Open
#651 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What are you trying to do?
I would like to be able to build and run docker compose containers using environment variables not stored in an env file. We are trying to test spinning up n database containers where n is configurable. Each database has its own name and root credentials which are generated dynamically so we cannot hard code them in env files.

Why should it be done this way?

This enhancement would allow users to define the environment variables for a docker compose service at runtime. Gives the library more flexibility.

Other references:

Docker Compose Environment Variable Options.

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 at the DockerCompose entry point and read Docker's Environment Variable Options reference linked in the issue, then trace how compose services and environment files are configured. Done means callers can provide runtime-generated variables for compose services, including dynamic database names and credentials, without requiring an env file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, python
Domain
infrastructure, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.