background Use idea with docker to realize the whole process from javaweb development, deployment, and operation. Open Docker remote connection The online method cannot find the corresponding docker.service file, maybe the version or installation method is different. Modify the /etc/systemd/system/docker.service file: #ExecStart=/usr/bin/dockerd ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock Restart the Docker service: systemctl daemon-reload systemctl restart docker.service Port 2375 is open: firewall-cmd --zone=public --add-port=2375/tcp --permanent firewall-cmd --reload After restarting, verify whether port 2375 is accessible: Note: This indicates success. idea docker plugin configuration idea 2019 version 3 has integrated docker. If it is not integrated, please install it yourself. Note: docker - After clicking "+", fill in the connection name and Linux host IP: docker external port Connect idea to docker and familiarize yourself with the available operations on the relevant interface: Note: It integrates common commands including containers and basic images. You can study their specific usage by yourself, which is not difficult. Add Dockerfile to SpringBoot Application Note: The same directory as the pom file, the file contents are as follows: FROM openjdk:8u212-jre MAINTAINER aliyu<[email protected]> COPY target/myframe-0.0.1-SNAPSHOT.jar /myframe-0.0.1-SNAPSHOT.jar ENTRYPOINT ["java", "-jar", "/myframe-0.0.1-SNAPSHOT.jar"] Add docker run configuration Note: 1. Right click "edit configuration" clean package -U -DskipTest -P test Note: During development, the host accesses the MySQL container in Linux, and when the application is generated as a container runtime, the application container accesses the MySQL container. The mysql configuration in yml is inconsistent, so the test yml configuration file is used specifically for docker deployment. ps: For containers to access each other, please check the "Others - Communication between containers" title. After it is created, you can see: Note: There is one more dockerFile to start Run docker startup configuration Click: Note: You can see the complete process of Maven clean packaging, as well as the process of Docker building images, creating and starting containers. You can even see the logs of the container startup project Test access to the swagger homepage: other Communication between containers Background: Because I don’t understand how containers communicate with each other, when configuring MySQL connection, the URL is always wrong and database connection problems are always reported. The host IP plus the mapped port can access the mysql8 container: However, accessing the myframe container through the host IP plus the mapped port fails because the communication between containers is different It cannot be accessed through localhost:3306. The localhost in the docker container does not refer to the localhost of the host machine. Docker creates a virtual network card at runtime and names it docker0 This is the end of this article about the latest IDEA to quickly implement Docker image deployment and operation. For more related IDEA Docker image deployment and operation content, 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:
|
<<: How to check if a table exists in MySQL and then delete it in batches
The following three methods are commonly used to d...
I usually like to visit the special pages or prod...
Table of contents Overview Install Gulp.js Create...
1. Request answer interface 2. Determine whether ...
Box-sizing in CSS3 (content-box and border-box) T...
This article shares the specific code of JavaScri...
At the end of last year, I replaced the opensuse ...
1. Avoid declaring the page as XML type . The pag...
1. Delete node Execute kubectl delete node node01...
I took the bus to work a few days ago. Based on m...
Designers have their own font library, which allo...
1. When to execute setUp We all know that vue3 ca...
Problem Description 1. Database of the collection...
Table of contents Business Background Using Techn...
1. Install MySQL software Download and install My...