How to Structure Production-Safe Docker Compose Stacks
On my 3-node Dell OptiPlex 9020 Proxmox VE cluster (proxmox01, proxmox02, and proxmox03), Docker hosts live inside dedicated VMs or unprivileged LXC containers on VLAN 100. The single biggest difference between a fragile weekend test stack and a home lab that survives reboots and upgrades is consistent directory layout and clean separation between configuration and secrets.
Step-by-Step Deployment Workflow
- Select your core services: Check the applications you want to deploy together, such as AdGuard Home, Uptime Kuma, Gotify, or CouchDB. Keep unrelated services in separate Compose directories so restarting one app does not disrupt your DNS or monitoring stack.
- Standardize your base storage path: Setting a predictable root like
/opt/homelab/dataor./datakeeps every bind mount under one folder. When Proxmox Backup Server (PBS) orrsyncruns nightly snapshots, backing up that single directory captures every database and config file. - Verify PUID and PGID ownership: Run
idon your Linux host before starting containers. MatchingPUID=1000andPGID=1000prevents containers from writing root-owned files that lock out your regular user during edits or backups. - Check for host port conflicts: Ubuntu hosts running
systemd-resolvedbind port53by default, which collides with Pi-hole and AdGuard Home. Override conflicting host ports in step 3 above, or disable the stub listener before runningdocker compose up -d.
Security & Maintenance Rules of Thumb
- Never commit secrets to YAML: Keep database passwords, API tokens, and tunnel keys inside
.envand add.envto.gitignore. If you share or back up yourdocker-compose.yml, your credentials stay local. - Bind to localhost behind tunnels or reverse proxies: If a service is only accessed through a Cloudflare Zero Trust Tunnel or Nginx Proxy Manager on the same host, bind its port as
127.0.0.1:8080:8080instead of8080:8080so it is not exposed on your LAN interface. - Avoid blind auto-updates on databases: Use a delayed updater like Arcane with version pinning rather than blindly pulling
:lateston PostgreSQL or CouchDB containers, where a major version jump can require manual schema migration. - Use named user-defined bridge networks: Placing related containers on a dedicated bridge network (such as
homelab_net) enables automatic Docker DNS resolution by container name, so Uptime Kuma can pinghttp://gotify:80without hardcoded LAN IPs.