Get the App
SLTechnology News&Howtos  ›  Development  › 

How to deploy Micro Services quickly by docker maven plugin

Shulou Source: shulou.com Published: 2022-05-31 21:53:09 09月23日 Update

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!

Tags: Services configuration files mirroring commands machines content methods results learning practicality deeper success location interest address foundation practicality reality container Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Microsoft MariaDB OPPO Reno MySQL