国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

在Idea中使用Docker部署SpringBoot項目的詳細步驟

瀏覽:41日期:2023-09-25 15:49:45

前言

項目需要:

安裝Dockeridea中安裝docker插件,并配置docker一個SpringBoot項目創建Dockerfile

一、下載、安裝、配置Docker下載Docker

下載地址:官網下載 Docker

安裝

一直下一步就行

配置路徑:Settings?General 勾選 Expose daemon on tcp://localhost:2375 without TLS

在Idea中使用Docker部署SpringBoot項目的詳細步驟

設置鏡像,提高下載鏡像的速度https://xaiqlt1z.mirror.aliyuncs.com

在Idea中使用Docker部署SpringBoot項目的詳細步驟

測試是否安裝成功

C:Usersmsi>docker -vDocker version 19.03.12, build 48a66213feC:Usersmsi> docker run hello-worldHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the 'hello-world' image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID: https://hub.docker.com/For more examples and ideas, visit: https://docs.docker.com/get-started/

二、Idea 安裝Docker插件

1.安裝docker插件在idea中: file--Plugins--Marketplace 搜索 Docker 安裝

在Idea中使用Docker部署SpringBoot項目的詳細步驟

2.配置Docker服務

file ? 搜索docker ? 選擇Docker ? 右側添加一個DockerConnection successful 顯示,表示 Docker鏈接成功

在Idea中使用Docker部署SpringBoot項目的詳細步驟

三、創建SpringBoot項目,修改pom.xmlspringMVC 項目,訪問 localhost:8080/hello 顯示 hello 字符串

@RequestMapping('/hello') @ResponseBody public String hello () { return 'hello'; }

1.配置pom.xml 文件

<build> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions> <execution> <goals> <goal>repackage</goal> </goals> </execution></executions> </plugin> <plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId><version> 1.2.1</version><executions> <execution> <id>build-image</id> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution></executions><configuration> <imageName>${project.artifactId}</imageName> <imageTags> <imageTag>latest</imageTag> </imageTags> <dockerDirectory>${project.basedir}</dockerDirectory> <dockerHost>http://localhost:2375</dockerHost> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}</include> </resource> </resources></configuration> </plugin> </plugins> </build>

2.創建Docker 文件

在main文件夾下創建一個docker文件夾,并在里面創建一個Dockerfile文件。xxxxx.jar 是使用maven打包后復制進來的。

在Idea中使用Docker部署SpringBoot項目的詳細步驟

Dockerfile 文件內容:

# From java image, version : 8FROM java:8# 掛載app目錄VOLUME /app# COPY or ADD to imageCOPY demo-0.0.1-SNAPSHOT.jar app.jarRUN bash -c 'touch /app.jar'EXPOSE 8080ENTRYPOINT ['java', '-jar', 'app.jar']

maven打包,將其target目錄下的jar包復制進docker目錄下。

配置Dockerfile配置

在Idea中使用Docker部署SpringBoot項目的詳細步驟

運行

在Idea中使用Docker部署SpringBoot項目的詳細步驟

運行成功

在Idea中使用Docker部署SpringBoot項目的詳細步驟

測試

使用docker 檢查容器是否啟動:

在Idea中使用Docker部署SpringBoot項目的詳細步驟

測試項目是否啟動:

在Idea中使用Docker部署SpringBoot項目的詳細步驟

總結

今天學了下Docker容器,基本的命令學會了,但是一直沒弄懂怎么使用。借此機會就花費時間進行學習。目前只是會用,后面會補上步驟詳細描述。

到此這篇關于在Idea中使用Docker部署SpringBoot項目的文章就介紹到這了,更多相關Docker部署SpringBoot項目內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 视频二区欧美 | 欧美一级久久久久久久大 | 国产成人香蕉久久久久 | 99久久免费精品国产免费 | 大陆精品自在线拍国语 | 国产成人资源 | 精品网址| 最近韩国日本免费免费版 | 亚洲另类激情综合偷自拍 | 亚洲天堂久久新 | 国产毛片不卡 | 美女视频黄a | 日韩中文字幕视频 | 免费播放特黄特色毛片 | 国内自拍第100页 | 日本www免费视频网站在线观看 | 日本成人不卡视频 | 精品区 | 亚洲视频99| 九九久久精品视频 | 日本vs欧美一区二区三区 | 洋老外米糕国产一区二区 | 日韩免费一级毛片 | 精品国产高清在线看国产 | 亚洲综合视频在线观看 | 天堂一区二区三区在线观看 | 亚洲精品免费在线 | 久草在线视频免费播放 | 亚洲色吧 | 成人a毛片在线看免费全部播放 | 91资源在线观看 | 久久99久久精品免费思思 | 亚洲美色综合天天久久综合精品 | 久久久久国产精品美女毛片 | 成人手机在线视频 | 波多野结衣一级 | 男女午夜性爽快免费视频不卡 | 亚洲精品高清在线 | 特黄特黄一级高清免费大片 | 日本免费一区二区三区毛片 | 老鸭窝 国产 精品 91 |