How to define a container stack while maintain in some inheritance principles?

I have dozens of services that I wish to be able to segregate them based on function area. Let’s just assume I have 3 for now. network, editors, media.

I was planning on using the include directive to keep files of a manageable size. The goal was to create a “stack” directory which will have a compose.yaml and .env file. Each function area would have a directory name of the function area, and the same two files. Theoretically function areas could have sub-groups, and sub-sub-groups, but let’s keep it simple for now.

├── stacks/
│   │   ├── compose.yaml
│   │   └── .env
│   ├──── network/
│   │       ├── compose.yaml
│   │       └── .end
│   ├──── editors/
│   │       ├── compose.yaml
│   │       └── .env
│   ├──── media/
│   │       ├── compose.yaml
│   │       └── .env

stacks/compose.yaml might look something like:

include:
  - path: ./network/compose.yaml
  - path: ./editors/compose.yaml
  - path: ./media/compose.yaml

stacks/.env might look like:

TZ=America/New_York
PGID=1000
PUID=1000

All three service areas might need these values, but there’s no reason to have to type them in again? Likewise these service areas might have API tokens the others don’t need.

What’s the solution for this?

Posted Mar 8, 2026, 8:05 PM UTC

75
Loading comments…