In my Spring Boot application, I want to output properties to run in a Docker container. When deployed for the first time, properties that are currently in my-server/src/main/resources/application.ymlare loaded and used by the application, as expected. Everything works great.
However, my problem is that I need these properties to be updated as needed, so I need to access the file application.ymlonce in the Docker container. But at the moment it is not included in the directory build/docker/before starting the task buildDocker, therefore it will not be copied or available after the first deployment.
So, I tried to copy the Yaml file to the assembly directory docker/, copy it to an accessible directory ( /opt/meanwhileinhell/myapp/conf), and use the property spring.config.locationto pass the configuration location in the Jar to my Dockerfile:
ENTRYPOINT ["java",\
...
"-jar", "/app.jar",\
"--spring.config.location=classpath:${configDirectory}"]
Looking at the command running in the Docker container, I see that this is as expected:
/app.jar --spring.config.location=classpath:/opt/meanwhileinhell/myapp/conf]
However, when I update a property in this file and restart the Docker container, it does not commit the changes. File Permissions:
-rw-r--r-- 1 root root 618 Sep 5 13:59 application.yml
The documentation documentation says:
When configurable custom locations are configured, they are used in addition to the default locations. Custom locations are searched to the default location.
, , , , , , Docker ?