How to use Docker plugin to remotely deploy projects to cloud servers in IDEA

How to use Docker plugin to remotely deploy projects to cloud servers in IDEA

1. Open port 2375

Edit docker.service

vim /lib/systemd/system/docker.service

Add configuration after ExecStart

-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock 

Added content

Restart docker network and docker

systemctl daemon-reload
systemctl restart-docker

Centos7 open ports

firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload

Check if the port is being monitored

netstat -lnp | grep 2375

If it is monitored, it proves success

Note: It is unsafe to expose port 2375. If you do not need to access port 2375 from the external network, close this port in time .
firewall-cmd --zone=pulic --remove-port=2375/tcp --permanent
Open the specified port to the specified IP: iptables -I INPUT -s IP -p tcp --dport 2375 -j ACCEPT

2. IDEA installs and configures the Docker plug-in

Install

Install Docker Integration

After IDEA installs Docker Integration, restart IDEA.

Configuration

Configuration as shown

If the IP and port of the cloud server are correct, the connection will be successful as shown below.

Remote publishing project

Write a Spring Boot project for release. The port is configured as 8080

@RestController
@RequestMapping("hello")
public class HelloWebfluxController {

  @GetMapping("webflux")
  public Mono<String> mono(){
    return Mono.just("hello webflux");
  }

}

Pack

mvn clean package

Writing a Dockerfile

The Dockerfile is placed in the project root path.

FROM java:8
VOLUME /tmp
COPY target/hello-flux-0.0.1-SNAPSHOT.jar hello-flux.jar
RUN bash -c "touch /hello-flux.jar"
# 8080 port EXPOSE 8080
ENTRYPOINT ["java","-jar","hello-flux.jar"]
# docker run -d -p 8080:8080 --name docker-resource demo/hello-flux:1.0

It is also OK to put Dockerfile in src/main/resoures. The important thing is to indicate where the jar package to be run is.

Configuration

Select Dockerfile

Specifying Ports

Specify the location of the Dockerfile in the configuration.

Bind ports Bind port mapping

Command line can manually enter other parameters

run

After clicking Run, wait for a moment.

success

The console prompts that the release is successful.

Check whether the remote host has successfully published the image.

Mirror

Check whether the docker container is started in the remote host.

The container started successfully

Successful access.

access

This is the end of this article about the steps of using the Docker plug-in in IDEA to remotely deploy projects to the cloud server. For more relevant content about Docker remote deployment to the cloud server, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Steps for IDEA to integrate Docker to achieve remote deployment
  • Detailed steps for IDEA to integrate docker to achieve remote deployment
  • Idea deploys remote Docker and configures the file
  • Detailed tutorial on how to connect to a remote server Docker to deploy a Spring Boot project in IDEA
  • Java remote one-click deployment of springboot to Docker through Idea
  • Implementation of IDEA remote management of docker images and container services

<<:  Native JS to implement breathing carousel

>>:  MySQL Null can cause 5 problems (all fatal)

Recommend

Docker-compose quickly builds steps for Docker private warehouse

Create docker-compose.yml and fill in the followi...

How to use axios request in Vue project

Table of contents 1. Installation 2. There is no ...

How to solve the phantom read problem in MySQL

Table of contents Preface 1. What is phantom read...

How to Enable or Disable Linux Services Using chkconfig and systemctl Commands

This is an important (and wonderful) topic for Li...

Summary of a CSS code that makes the entire site gray

In order to express the deep condolences of peopl...

VUE+Canvas realizes the whole process of a simple Gobang game

Preface In terms of layout, Gobang is much simple...

JavaScript to achieve simple drag effect

This article shares the specific code of JavaScri...

Linux uses lsof command to check file opening status

Preface We all know that in Linux, "everythi...

Detailed explanation of several methods of installing software in Linux

1. RPM package installation steps: 1. Find the co...

Core skills that web front-end development engineers need to master

The content involved in Web front-end development...

Analysis of the Docker deployment Consul configuration process

Execute Command docker run -d --name consul -p 85...

Application scenarios and design methods of MySQL table and database sharding

Many friends have asked in forums and message are...

Implementation of running SQL Server using Docker

Now .net core is cross-platform, and everyone is ...