Search code examples
dockerspring-bootdocker-swarmdocker-machine

How to provide application.properties file to spring boot docker image as input


I have spring boot docker image. I provided all arguments(environment variables) in application.properties file. How to provide this file while running the application through docker image as input.

Please help me.


Solution

  • You can use docker volumes and start your spring boot application within the docker image like

    java -jar /path/to/volume/yourapp.jar --spring.config.location=file:/path/to/volume/application.properties
    

    The application.properties is then externalized to the folder the volume is associated to.