Home > other >  Outside the docker mirror how to modify the application configuration
Outside the docker mirror how to modify the application configuration

Time:09-20


Wrote a spring boot web application, did a configuration files in the root directory. Hello, yml, web should read the hello. Data in the yml, local jars and project operation, no problem, write good DockerFile, then docker - compose compilation, success! Start normal, can access, but the problem is that I want to pass the docker - compose. Yml volumes in the hello. Yml mounted outside the image, so each time to fix the hello. Yml, can change place, but finish configuration, no effect,
Docker - compose. Yml file contents:
Version: '3'

Services:
Elasticsearch:
Build: elasticsearch
Ports:
9200-9200:
Expose:
- 9300
Environment:
- "ES_JAVA_OPTS=- Xms512m - Xmx512m"
Networks:
- "internal"
Volumes,
- esdata:/usr/share/elasticsearch/data
-./elasticsearch/config/elasticsearch. Yml:/usr/share/elasticsearch/config/elasticsearch. Yml
Ulimits:
Nofiles:
Soft: 65536
Hard: 65536

Kibana:
Image: docker. Elastic. Co/kibana/kibana: 5.6.4
Networks:
- "internal"
Ports:
5601-5601:
Elasticsearch - head:
Image: mobz/elasticsearch - head: 5
Networks:
- "internal"
Ports:
9100-9100:
App:
Build: the helloWorld
Ports:
9090-9090:
Expose:
- 9090
Networks:
- "internal"
Volumes,
-./helloWorld/config/hello. Yml:/app/app. The jar!/BOOT-INF/classes!/hello. Yml

Volumes,
Esdata:
Driver: local

Networks:
Internal:
Driver: "the bridge"
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -,
DockerFile content
The FROM Java: 8
VOLUME/TMP
RUN the mkdir/app
ADD the HelloWorld - 0.0.1 - the SNAPSHOT. Jar/app/app. The jar
The ADD runboot. Sh/app
The RUN bash - c 'touch/app/app. Jar'
WORKDIR/app
The RUN chmod + x a runboot. Sh
EXPOSE 9090
CMD/app/runboot. Sh
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Runboot. Sh

Sleep 10
Java - Djava. Security. Or egd=file:/dev/./urandom - jar/app/app. The jar
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Hello. Yml
YourName: Jack and Rose,
Words: welocome to China
  • Related