IDEA uses Docker plug-in techniques



1 docker to turn on remote and access

2 Connect docker

3 Retrieval of Mirrors

4. Create containers and run them

5 springboot project docker deployment


Previous articles mostly described docker mirroring pull-out, container creation, etc., which required a lot of commands to be remembered and quite skilled to deploy a project using docker. It would take a lot of time to deploy remotely using docker plug-in in idea. If you deploy remotely using docker plug-in, you can deploy remotely without typing commands. Here's an overview of ideaThe magic of docker plugins.

Prepare win10 to communicate with the local virtual machine without closing the firewall

Reference Documents win10 communicates with local virtual machines without closing the firewall _chenjin_csdn's blog-CSDN blog

1. Turn on docker remote access

The main point here is how to open docker remote access

First we need to configure docker's mirror accelerator (otherwise, pull image will be slow). Mirror acceleration We use Ali mirror, or NetEase or ustc

{"registry-mirrors": ["ali address", """""]}

The preconditions are set, and then the docker transport city visit is officially configured to open.
Start by editing the docker's host file/lib/systemd/system/docker.

vi /lib/systemd/system/docker.service

Modify the line starting with ExecStart (if the system is centos 7):

ExecStart=/usr/bin/dockerd -H tcp:// -H unix://var/run/docker.sock

If it is below centos7, change ExecStart to:

ExecStart=/usr/bin/dockerd -H fd:// -H tcp://

Save the file after modification and notify the docker service of the modification

systemctl daemon-reload

Restart docker service

service docker restart

Test to see if you can connect to docker api

curl http://localhost:2375/version

2. Connect docker

Download docker plugins

Click on idea's settings option (file --> setting -> docker) to create a new connection


Open the project and click services connection in the lower left corner

Once the connection is successful, you can use the docker on the server (virtual machine)


3. Retrieval of Mirror

idea pulls the mirror visually

All we need to do is fill in the repository with the name of the image we want to pull

Remove Mirror

4. Create containers and run them

Fill in container name and mapping port

View Log Run Successfully

5. springboot project docker deployment

In general, docker deploying springboot projects requires manual configuration of the Dockerfile itself and uploading the generated jar packages to the server along with the Dockerfile files, which is particularly cumbersome. It is very convenient to deploy springboot projects at one click using idea docker plug-in.

The springboot project introduces docker building tools

        <!-- Quote our project name -->


            <!--Use docker-maven-plugin Plug-in unit-->
                <!--Bind the plug-in to a phase implement-->
                        <!--Users only need to execute mvn package ,Will execute automatically mvn docker:build-->

                    <!--Specify the generated mirror name,Here's our author name+Project Name-->

                    <!--Specify label Specify here the mirror version, our default version is latest-->

                    <!--Specify Base Mirror jdk1.8-->
                    Mirror Producer Personal Information
                    <!--switch to ROOT Catalog-->

                    <!--View our java Edition-->
                    <cmd>["java", "-version"]</cmd>

                    <!--${}.jar Is generated after packaging jar The name of the package-->
                    <entryPoint>["java", "-jar", "/${}.jar"]</entryPoint>

                    <!--Specify Remote docker api address-->

                    <!-- Here is the copy jar Package to docker Container Specified Directory Configuration -->
                            <!--jar The path where the package is located  The corresponding configuration here target Catalog-->
                            <!--Used to specify which files need to be copied to include jar Package, which corresponds to Dockerfile File name added in -->


Next, click clean to clear all previously packaged files, then click package packaged files to complete the construction of the image and achieve one-click deployment.


Tags: Linux Docker Spring Boot IDEA

Posted on Mon, 13 Sep 2021 13:25:12 -0400 by ps2gamer