Comments (10)
Hey, and thank you for the suggestion and well described situation!
Currently the script is checking for
ContEnv=$(docker inspect "$i" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}')
Then it's started with something similar to this:
docker compose --env-file "$ContEnv" up -d
Maybe this only works a single env-file? And maybe only if declared through the compose-file?
I'll try to do some testing this weekend and see what I can achieve. But if you can/want I'd gladly receive some more info from how things look at your side of this.
What do you get if you run this on a container with multiple env-files?
docker inspect "ContainerABC" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}'
(replace ContainerABC)
from dockcheck.
Done some simple testing on my phone and might have a simple solution ready 😅
Just need some further testing.
But that is not adding the option for custom setting of env-files on the fly, but rather using the list like your test above and just starting the container again with all env-files with ... --env-file /path/file1.env --env-file /path/file2.env
Is this solving your issue?
from dockcheck.
No sorry, I was unclear.
What the "new version" would do is just look up your specific containers current .env-files and then start that same container with the same .env-files.
I'll describe with your sample above.
- You'll run dockcheck and choose to update
cloudflare-ddns
. - The script would then do a check, as
docker inspect "cloudflare-ddns" .....
(in the example above) - It will find the env-files:
/home/buddy/villa-kunterbunt/global.env,/home/buddy/villa-kunterbunt/cloudflare-ddns/local.env
- It will then update the container, then start it with:
docker compose --env /home/buddy/villa-kunterbunt/global.env --env /home/buddy/villa-kunterbunt/cloudflare-ddns/local.env up -d
No matter how many env files or in which order you've specified them, no matter if they're defined in the compose-file itself or by --env flag.
from dockcheck.
Sure, I'd be happy to give you more insights.
Basically, I don't have any labels for the .env files within docker-compose.yml. I've had some problems with the paths (even if it's only one folder up). That's why I include the files directly when starting the individual compose file.
However, I would also try it again if the script is changed here.
As I understand it so far, the start command only allows one env file?
Here is an example of what docker inspect returns for me when both .env files are given at startup:
docker inspect "cloudflare-ddns" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}'
/home/buddy/villa-kunterbunt/global.env,/home/buddy/villa-kunterbunt/cloudflare-ddns/local.env
from dockcheck.
Thank you thats great info! So the grab of the current env files seems correct.
But you're right the current way only include 1 env file and maybe breaks due to the comma separated list of current files.
I'll do some testing when I have time and see if I can adjust the logic. Thank you.
from dockcheck.
I don't think I quite understand your approach. I guess I'm on the wrong track 😅
Do you mean that I would maintain a list containing the env files required for the operation of the respective service?
from dockcheck.
Ok, now I've understood. Of course that would be ideal and would cover my case 100%. At least as far as I've seen so far.
Very cool idea. I could have thought of that after you asked with docker inspect 😊
from dockcheck.
Wonderful!
I've put together a new branch with the adjustments. I've tried it on a few test-containers and it seems to work as planned.
new branch
If you'd like to test it on one of your containers that'd be awesome!
Just clone/download the dockcheck.sh
and try to run it with ./dockcheck.sh cloudflare-ddns
or some other container that can handle a couple of seconds downtime if you'd need to restart it manually with your correct --env-file flags if it doesnt start as it should.
from dockcheck.
That's brilliant. I have just tested it with different services and it always started with the same env files. Even an update with a new image and subsequent start went through without any problems. Thank you very much for the quick help and solution to my enquiry 😊
Are you closing the issue?
from dockcheck.
Wonderful!
The quick work was thanks to your collaboration and info. Thank you for reporting and testing.
It will close when I merge the branch with main in a bit.
from dockcheck.
Related Issues (20)
- [FEATURE REQUEST] email notification (patch included) HOT 3
- Only update container if the new container is X days old HOT 6
- [FEATURE REQUEST] monochrome mode HOT 6
- [Feature Request] Update docker-compose stacks and/or Respect docker-compose "depends_on" HOT 11
- Raspberry Pi - Cannot install regctl HOT 3
- [chore] forgot to add the v0.3.2 branch :) HOT 1
- [Feature] Integration for pushbullet support - script attached HOT 3
- Add capability to authenticate with docker account when pulling images HOT 5
- [FEATURE REQUEST] save preference regarding updates (git/curl) HOT 1
- Progress bar fails with -s option HOT 3
- [FEATURE REQUEST] Automatically download latest in use notification add-on HOT 3
- [Feature] Add -v flag for version number printing of dockcheck HOT 1
- [FEATURE REQUEST] Add Link to GitHub repo HOT 3
- Show current/available image version HOT 4
- [FEATURE REQUEST] Telegram notification HOT 3
- [FEATURE REQUEST] Minimal Output HOT 6
- Readme: add install instructions HOT 5
- [Feature Request] - Web Interface Productivity Improvements / Updates Suggestions HOT 2
- Idea: package the repo into an container HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockcheck.