Is exists tool to dynamically set services
, external_links
, etc. for container orcestration, depend from enviroment variable?
Tool should have convenient syntax (Python/js/bash - any clearly readable), and support conditions (if).
Now I have 3 files like docker-compose.local.yml
, and edit them all.
cp docker-compose.local.yml docker-compose.yml;
docker-compose up;
I wan't one config file
ENV=local;
docker-compose up; # or "node start-compose.js"
I know that docker-compose supports enviroment variables like
volumes:
- ${ENV}-filename:/.../filename
But I need more.
You can use .env
files to store all your compose configuration.
Just as you do cp docker-compose.local.yml docker-compose.yml;
You do cp local.env.env;
docker-compose up
will automatically pick up the .env
file.
Taken from the docs Environment Variables in Compose
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.