0

I was asked to externalize my properties file from my wars file and gave a file an external path, because I have a docker image with a tomcat Inside and I was asked to master the files outside my docker.

how to do that?

I already know how to modify the pom to exclude my file from the build.

kiki keke
  • 99
  • 2
  • 10
  • take a look [here](https://stackoverflow.com/questions/46057625/externalising-spring-boot-properties-when-deploying-to-docker) – Pp88 Jul 28 '22 at 15:55

1 Answers1

1

You can mount a volume in docker container to a path in host machine. Now when you create any application.properties file on host machine path, same will be visible and accessible to docker container as well.

Below is the plain docker run command to achieve it.

docker run -it --rm -v /home/k/myDocker:/k busybox sh

Below is the docker-compose.yml approach

version: '3'

services:
  prometheus:
    image: prom/prometheus
    volumes:
      - prometheus-data:/prometheus

volumes:
  prometheus-data:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /disk1/prometheus-data
sapan prajapati
  • 1,514
  • 19
  • 16