


How does idea quickly package the SpringBoot project into a Docker image and deploy it?
1. Modify the docker configuration file
Modify the file information path as follows:
/etc/docker/daemon.json
Add the following content to the configuration file:
1 |
|
Note: If you don’t have this daemon.json, create one yourself in the /etc/docker/ directory
1 |
|
tcp is for remote access, and unix is for local access. If local access is not enabled, the following error will occur when using it on the server:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running ?
After the modification is completed, execute the following commands in sequence:
1 2 3 4 5 6 |
|
1 2 3 4 5 6 |
|
1 |
|
##4.IDEA configure docker
Note: I mentioned above 192.168.1.2 is my own server IP. Just change it to the server IP where your docker is located.
Click to connect, and we will find that our docker configuration Container information
5. SpringBoot integrated Docker configuration
5.1 Install pom dependencies
Install plug-in: Docker-maven-plugin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
All my maven configurations are as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
Note: After we successfully pull the plug-in, we will find that the directory structure becomes as follows:
We need to delete a startup class, otherwise the packaging will fail. I deleted the DockerApplication directly
5.2 build image
Before building the image, we need to package the project first Operation
Enter our project directory through cmd
Execute
1 |
|
The following information appears Indicates successful packaging
Next, return to our idea, you can see that
This is what we packaged Mirror
1 |
|
You can also see the image information
5.3 Start the mirror
on our server Execute within
1 |
|
Note: The reason why I exposed port 8089 is because of a conflict with 8080. You can change it according to your own situation
Continue Let’s visit the test interface we wrote:
You can see that it has been successfully deployed and can also be accessed successfully
We can see that it can also be viewed in Idea Let’s get to the image we just started successfully and the log output
The above is the detailed content of How does idea quickly package the SpringBoot project into a Docker image and deploy it?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)

The steps to update a Docker image are as follows: Pull the latest image tag New image Delete the old image for a specific tag (optional) Restart the container (if needed)

Methods for copying files to external hosts in Docker: Use the docker cp command: Execute docker cp [Options] <Container Path> <Host Path>. Using data volumes: Create a directory on the host, and use the -v parameter to mount the directory into the container when creating the container to achieve bidirectional file synchronization.

How to restart the Docker container: get the container ID (docker ps); stop the container (docker stop <container_id>); start the container (docker start <container_id>); verify that the restart is successful (docker ps). Other methods: Docker Compose (docker-compose restart) or Docker API (see Docker documentation).

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

How to use Docker Desktop? Docker Desktop is a tool for running Docker containers on local machines. The steps to use include: 1. Install Docker Desktop; 2. Start Docker Desktop; 3. Create Docker image (using Dockerfile); 4. Build Docker image (using docker build); 5. Run Docker container (using docker run).
