8

I have a scala sbt application and have a default application.conf. I built a docker image to run this application via docker. How can I replace the default application.conf in the docker container at a run time?

vkt
  • 1,401
  • 2
  • 20
  • 46

1 Answers1

7

I'd recommend instead of passing application.conf file with overrides, go with overrides based on environment variables, because of reasons like:

  • Mounting volume with configuration file might be tricky from deployment tools perspective;
  • Not all configurations management tools (for instance HashiCorp Consul) provide HOCON support, but managing environment variables is almost a standard. Especially if it contains secrets which needs to be protected;

So, you can do next: In your application conf set overrides via environment variable:

foo=default
foo={?FOO}

And run application docker container with specific override:

docker run ...
 -e foo=bar \
 ...

Please, see for more details:

Hope this helps!

Ivan Kurchenko
  • 4,043
  • 1
  • 11
  • 28