【docker】docker部署spring boot服务 选择配置文件启动

时间:2023-03-08 19:31:54
【docker】docker部署spring boot服务 选择配置文件启动

默认启动命令:

docker run --name swapping -itd --net=host -v /etc/localtime:/etc/localtime:ro  -v /etc/timezone:/etc/timezone:ro  swapping

则 默认启动的配置文件是application.yml或者application.properties文件

如果要选择以开发配置文件启动则:

docker run --name swapping -itd --net=host -v /etc/localtime:/etc/localtime:ro  -v /etc/timezone:/etc/timezone:ro  swapping  --spring.profiles.active=pro

加上参数,则启动的配置文件就是application-pro.yml或者application-pro.properties文件。