← sources

Version control for docker compose environment

source: reddit (reddit:selfhosted)published 2026-10-27 02:57ingested 2026-10-28 02:37

retained text

I'm trying to keep my docker / docker compose configuration in git to make it easy to recreate if things go bad. Of course, also trying to keep passwords out of the git repo. The problem I'm seeing is that a lot of projects provide a recommended compose.yaml file that pulls a lot more than just passwords from the .env file - things like a database names, urls, or port numbers, all info that I want under version control. Except it has the passwords mixed in.

How do people really deploy your systems? Do you have a secret.env and a non-secret.env file and use the docker compose command line option to load both? Do you just modify the compose.yaml file to embed the non-secret config options and hope upgrades won't require a complicated merge?

I'm setting this up, but I'm not living and breathing it every day so I appreciate not having to remember which env files to load on each restart. I can set up a system, but the reality is the more I need to remember each time translates directly into the more likely I will be to make a mistake. But at the same time I am worried about upgrading if I modify the stock setup files too much. 

document fetched 2026-10-28 00:30 · canonical https://reddit.com/r/selfhosted/comments/1xghbex/version_control_for_docker_compose_environment