Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker dynamic configuration files

Some of my Docker containers require configuration files (think: JSON, YAML or INI files) that depend on environment variables and/or container arguments.

What is the standard approach to automatically generate those environment files?

Solutions I have considered so far include:

  1. Tiller: but I'm not excited by the idea of adding a ruby gem to my containers.
  2. A custom string replacement script written in the same language as my other applications: but I don't want to include an extra script in all my docker projects.
  3. sed -i s/ENVVAR/${ENVVAR}/g config.json: it works but it's a bit too "raw" for my taste.
like image 582
Régis B. Avatar asked Oct 17 '25 10:10

Régis B.


1 Answers

Check out confd, highly recommend it for this particular use case of "I want templating with minimal clutter in my image". confd allows you to use a local environment variable backend to template out whatever config file format you want.

like image 77
bluescores Avatar answered Oct 19 '25 10:10

bluescores