Docker – Override properties on Spring Config Server (Filesystem)

I have created a docker image of my config server, I decided to use the File System approach for learning purposes.

FROM openjdk:8-jdk-alpine
COPY target/config-server-0.0.1-SNAPSHOT.jar config-server-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "config-server-0.0.1-SNAPSHOT.jar"] 

My src/main/resouces tree looks like this:

└───resources
    ├───application.properties
    ├───bootstrap.properties
    └───config-repo
        ├───service-a.properties
        ├───service-b.properties
        ├───service-c.properties

This is one of the properties of application.properties

spring.cloud.config.server.native.search-locations=classpath:/config-repo

I want to override properties of the services included in the config-repo folder when I run my docker container. I’ve tried out the -e flag but it doesn’t work. Like this:

docker run -d -e "property.in.service.a=property" docker/image

Is this possible? I know it’s better to use a remote git repo, but I’m trying figuring out whether this is possible.

Source: StackOverflow