Organizing Docker Compose Files: Need Help with Environment Variables

0
7
Asked By ChillaxGuru42 On

I've been using Docker on my Synology 1019+ for a while now and recently decided to clean up my setup. Initially, everything was in one single compose file along with a single .env file. Now, I've categorized my containers into multiple subfolders with separate compose files and environment files. In my main docker-compose.yaml, I include paths to these subfiles, like protocols/govee2mqtt/govee2mqtt.yaml and their respective .env files. However, I'm running into an issue where one specific environment variable, PUIDBAZARR, defined in cinema/cinema.env, doesn't seem to be recognized. When I run 'docker-compose up -d', I get a warning saying that the variable isn't set and defaults to a blank string, even though it's correctly specified in the separate .env file. I want to make sure each service is running under its own user for security, instead of all applications running as the admin. What can I do to ensure that these environment variables are correctly read from the separate files? Any suggestions or improvements would be appreciated!

2 Answers

Answered By DockerDude123 On

It looks like you're on the right track with separating your compose files, but the variable not being picked up might indicate a loading issue. Make sure the paths in your main docker-compose.yaml are correct and that the environment files at those paths are accessible. You might also want to check if the variable names in your environment files match exactly what you're using in your compose files. Sometimes a small typo can cause these...

CuriousCat678 -

Thanks for the tip! I’ll double-check the variable names and paths in the files. I'll also ensure they have the correct permissions set.

Answered By LogicalFixer99 On

Honestly, I think keeping one compose file per service might simplify things. It could make it easier to manage dependencies and updates. The way you have it set up is cool, but if some containers are down, managing everything from a single file can be tricky. Is there a specific reason you're grouping them like this?

ThoughtfulMind47 -

I group them because I have difficulty multitasking due to a brain injury, and separating them this way helps me manage them better. If one container has issues, I can easily reload just that specific category.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.