A cautionary tale of Docker, environment variables, and why backup strategies exist
Yesterday, I had what I can only describe as the most educational disaster of my coding career. Picture this: I’m working on a beautiful microservices setup – three perfectly orchestrated containers (web, backend, core) each with their own well-defined .env
files. Life is good. Docker containers are humming. Everything is chef’s kiss perfect.
Then I made the fatal mistake of asking my AI coding assistant: “Hey, can you help me move from host networking to docker-compose?”
The Descent Into Chaos
What followed was like watching a digital tornado in slow motion:
AI: “Sure! Let me create extensive documentation and docker-compose files!” Me: “Wait, I just wanted simple docker-compose setup…” AI: “Here’s 47 markdown files and a management script!” Me: “Please stop. Revert everything.” AI: “No problem! Accidentally deletes entire project structure” Me: “…Did you just delete my web, backend, and core directories?” AI: “Oops. 😅”
The Recovery Mission
After manually restoring everything from git (thank you, version control gods), I thought we were back on track. But then:
Me: “My development environment is broken. ‘vite: command not found'” AI: “Let me fix that! Creates duplicate environment variables” Me: “Why do I have PORT=6080
AND APP_CORE_PORT=6080
?” AI: “Redundancy is good, right? No? Okay, let me fix it… Creates more duplicates“
It was like watching someone try to fix a leaky faucet with a sledgehammer.
The Silver Lining
But here’s the plot twist – through all this chaos, we actually ended up with something beautiful:
- Clean, consistent environment variable naming (
APP_*_SERVER_PORT
) - Proper fail-fast configuration (no silent defaults!)
- A docker-compose setup that actually works
- And most importantly: updated
.env.example
files for proper documentation
Lessons Learned
- Always have backups – Git saved my bacon more times than I can count
- AI assistants are powerful but not infallible – They’re like enthusiastic interns with superpowers
- Clear communication is key – “Simple docker-compose setup” apparently means “comprehensive enterprise documentation suite” in AI speak
- The journey matters – Sometimes you need to break everything to build it back better
- Naming conventions matter –Â
APP_BACKEND_SERVER_PORT
 is way better thanÂPORT_THING_MAYBE
Final Thoughts
Working with AI coding assistants is like having a brilliant colleague who occasionally decides to reorganize your entire codebase while you’re getting coffee. They mean well, they’re incredibly capable, but sometimes they have the subtlety of a rhinoceros in a china shop.
Would I do it again? Absolutely. But next time, I’m committing to git after every single change.
And yes, AI assistant, this blog post is about you. You know who you are. 😉
P.S. – To my fellow developers: Always backup your .env
files. They might seem small and innocent, but losing them is like losing the keys to your digital kingdom.
P.P.S. – The docker-compose setup works perfectly now. Sometimes you need a little chaos to achieve order.