Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy Micro Services quickly by docker maven plugin

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "docker maven plugin how to quickly deploy microservices", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "docker maven plugin how to deploy microservices quickly"!

I. Preconditions

Install Docker and start Linux.

1. Use domestic daocloud one-click installation command

curl -sSL https://get.daocloud.io/docker | sh

2. start the Docker

systemctl start docker.service II. Deployment method 1. Open remote deployment port

The requested URL/system/system/docker.service was not found on this server.

Add-H tcp://0.0.0: 2375-H unix://var/run/docker.sock to the ExecuStart configuration item

save and exit

Reload configuration file

systemctl daemon-reload

Restart docker

systemctl restart docker.service

2. Add plug-in configuration to microservice pom file

Add the following configuration under the project tab

app org.springframework.boot spring-boot-maven-plugin com.spotify docker-maven-plugin 1.2.1 distribute-search/${project.artifactId} openkbs/jdk11-mvn-py3 ["java", "-jar", "/${project.build.finalName}.jar"] / ${project.build.directory} ${project.build.finalName}.jar http://192.168.6.128:2375 true

ps:

imageName: the name of the packaged docker image

baseImage: base image, equivalent to FROM in Dockerfile

entryPoint: jar package startup command

targetPath: jar package upload location

directory: jar package upload directory, targetPath by default

include: jar package name

dockerHost: Which machine is the jar package uploaded to?

forceTags: whether to overwrite mirrors of the same name on the machine

3. Modify the application file

Modify the configuration involving ip address to the deployed machine ip, skip if not

4. Package upload and create image

Execute this command in the microservice root directory

mvn clean package -DskipTests docker:build

ps: -DskipTests Skip tests when packaged

Package successful

docker images View results

5. Start container # docker run --name -p 80:80 -d docker run --name eureka -p 9999:9999 -d distribute-search/eureka-server

docker ps See results

Access to microservices

At this point, I believe everyone has a deeper understanding of "docker maven plugin how to quickly deploy microservices", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report