Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Should I Get Application Configuration into my Docker Containers?

I read the following article about "How Should I Get Application Configuration into my Docker Containers?" https://dantehranian.wordpress.com/2015/03/25/how-should-i-get-application-configuration-into-my-docker-containers/

It summarizes 4 options for this that were relevant back in 2015. In short:

  1. Baking the Configuration into the Container

  2. Setting the Application Configuration Dynamically via Environment Variables

  3. Setting the Application Configuration Dynamically via Environment Variables (using an external kv store)

  4. Map the Config Files in Directly via Docker Volumes

I'm wondering if nowadays these options are still the only ones viable or are there any new options/patterns to do this?

Thanks.

like image 895
AAaa Avatar asked Jan 10 '18 08:01

AAaa


People also ask

Where are Docker container configuration files?

The preferred method for configuring the Docker Engine on Windows is using a configuration file. The configuration file can be found at 'C:\ProgramData\Docker\config\daemon. json'. You can create this file if it doesn't already exist.

How do I get Docker config?

To configure the Docker daemon using a JSON file, create a file at /etc/docker/daemon.json on Linux systems, or C:\ProgramData\docker\config\daemon.json on Windows. On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced. You can also start the Docker daemon manually and configure it using flags.


1 Answers

Eventhough this article was written in 2015, the configuration options stated for containers are still the same.

On the container level, options 1,2 and 4 are the only available options without using any external services.

For option 3, there are many key stores and services that can be used. But the idea is basically the same: Query a "service" and fetch the configuration during startup or runtime.

like image 150
yamenk Avatar answered Sep 22 '22 12:09

yamenk