You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
GMorris-professional
changed the title
Feature: Allow for the use of individual environment variables with DockerCompose
Feature: Allow setting environment variables with DockerCompose
Jul 23, 2024
The problem with your proposal on the other hand is if you inject -e flags into the compose command we call, and any of those commands fail (say, you did my_compose.exec_in_container() then the secrets will likely leak into your CI, thus exposing said secrets. That's not a good way to proceed.
Because compose itself supports setting these variables through the compose.yml and that support environment substitution on top of that, I recommend using those instead of manipulating the env flags on call.
Remember! Since the docker world moved to Go, we don't talk to the api directly for compose, but use the CLI as a bridge. 🙂
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.
The text was updated successfully, but these errors were encountered: