天天看點

dockerfile案例 springboot項目部署

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

1)、将springboot項目打包

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

2)、制作dockerfile檔案

dockerfile案例 springboot項目部署

3)、dockerfile檔案 打包成鏡像

####宿機 /usr/dockerfile/Dockerfile

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

 i)、Dockerfile檔案上傳到/usr/mykit目錄中

 ii)、項目包docker-0.0.1-SNAPSHOT.jar上傳宿機 /usr/mykit目錄中

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

iii)、打包

docker build -f Dockerfile -t myikit-member:1 .

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

4)、運作鏡像檔案

 docker run   -p 8070:8080      myikit-member:1 

dockerfile案例 springboot項目部署

#####宿機通路  curl localhost:8070/ 如下

dockerfile案例 springboot項目部署

 #####外網通路  http://192.168.223.128:8070/

dockerfile案例 springboot項目部署
dockerfile案例 springboot項目部署

java  -jar

繼續閱讀