← sources

How are you managing secrets with multiple .env files in a Docker Compose stack?

source: reddit (reddit:homelab)published 2026-09-27 06:39ingested 2026-09-28 02:40

retained text

I have a single Docker Compose stack with multiple applications, and each application has its own `.env` file:

    .env.keeper
    .env.trek
    .env.scrutiny
    .env.faved

I want to keep these files **separate per application** rather than having one large `.env` file containing secrets for everything.

# What I'm looking for

Ideally, my workflow would be as simple as:

    docker compose up -d

The `.env` files would be **encrypted at rest** and could be stored in Git alongside my Compose files. When I deploy the stack, I want the secrets to be:

**Encrypted** `.env` **files → decrypted at deployment time → injected into the appropriate containers**

I don't want to:

* Manually decrypt the files before every deployment
* Have plaintext `.env` files sitting on disk
* Maintain one massive `.env` file for every application

For example:

    .env.keeper.enc  ──┐
    .env.trek.enc    ──┤
    .env.scrutiny.enc──┼──> decrypt/inject at deployment → Docker containers
    .env.faved.enc   ──┘

document fetched 2026-09-28 00:34 · canonical https://reddit.com/r/homelab/comments/1wrd0r2/how_are_you_managing_secrets_with_multiple_env