scaladockerdocker-composedockerfilesbt-native-packager

pass external config file to docker container at runtime


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?


Solution

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

    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!