Recently I've been thinking about how to run a .Net application using Mono inside a Docker, along with this we'd like to use Twelve Factor config . Whilst it is possible to use some library to access environment variables instead of using appSettings it becomes difficult for database and message broker URLs which other libraries may expect to find within the App.config or Web.config file. The solution I came up with follows: Build the application without an App.config moving the existing configuration file renaming it App.config.template . Substitute any environment variables you want with ${} . E.g: <amqp> <connections> < connection name="rabbit" server="${RABBITMQ_URL}" password="${RABBITMQ_PASSWORD}" /> </connections> </amqp> Include within the Docker image a script named sub.sh similar to this and add it to /conf : #!/bin/sh while read line do eval echo ...
My personal blog about stuff that happens which I can't fit on twitter or when I want to keep a diary.