docker制作springboot项目镜像时指定配置文件
作者:互联网
好处是,如果配置文件里面的信息改变了,比如访问地址变了,可以修改配置文件后重新制作镜像,不用改java代码重新打jar包
Dockerfile文件内容:
FROM openjdk:8u102 RUN echo 'Asia/Shanghai' >/etc/timezone COPY ./app /add/app/ WORKDIR /add/app ENTRYPOINT ["java","-Xms512m","-Xmx512m","-Xmn200m","-Xss256k","-jar","geo-search-0.0.1-SNAPSHOT.jar","--spring.profiles.active=prod"] EXPOSE 20089
进入/mydata/images/geo-search目录,然后运行如下命令制作镜像
docker build -t geo-search .
启动镜像
docker run --name geo-search -v /home/tony/docker/upfiles:/add/upfiles -d -p 20089:20089 geo-search
标签:search,springboot,配置文件,app,镜像,docker,geo 来源: https://www.cnblogs.com/james-roger/p/15724602.html