Article directory
Overview
Using docker to run SpringBoot projects is a good choice. The traditional method requires manual packaging and uploading to the server, then using docker build to build the image, and then using docker run to start and run, which is inevitably a bit cumbersome. This article introduces how to use idea to help us complete these operations. Simplify operational procedures.
01 Connect to remote docker
(As shown in the picture above) Generally, a Docker is provided by default. If not, click the + sign to create a Docker Connection.
If there is a Dokcer connection, right-click to edit configuration.
Whether you are adding or editing a configuration, choose SSH
the method
Enter the server's IP, username and password to create an SSH connection.
After creating it, click the Connect button. (Picture below)
In this way, you can connect to the server and manage docker.
02 Local packaging
Click on the maven management tool on the right, and then click on skip testing above skip tests model
.
Then double-click clean
to clear the existing target, and then double-click package
to package.
After success, you can see the project's jar package on the left:
03 Create dockerfile
In the root directory of the project (that is, the directory at the same level as pom.xml), create a dockerfile file.
Fill it in according to your own project situation, this picture is for reference only.
04 Deploy and run
Click the triangle symbol in the upper left corner of the Dockerfile editing interface to run the container.
Configure the running parameters first, and then run:
there is no command line in the whole process, which is quite good.
You can explore more detailed usage by yourself.