In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "how to deploy Intellij IDEA to quickly achieve Docker image", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to deploy Intellij IDEA to quickly implement Docker images".
Catalogue
1. Docker enables remote access
2. Intellij IDEA installs the Docker plug-in
3. Spring boot service Docker deployment
4. Create a Docker image
Reference:
1. Docker enables remote access [root@izwz9eftauv7x69f5jvi96z docker] # vim / lib/systemd/system/docker.service# to modify ExecStart line ExecStart=/usr/bin/dockerd-H tcp://0.0.0.0:2375-H unix:///var/run/docker.sock
# reload configuration file [root@izwz9eftauv7x69f5jvi96z docker] # systemctl daemon-reload # restart service [root@izwz9eftauv7x69f5jvi96z docker] # systemctl restart docker.service # check whether the port is open [root@izwz9eftauv7x69f5jvi96z docker] # netstat-nlpt# Direct curl to see if it works [root@izwz9eftauv7x69f5jvi96z docker] # curl http://127.0.0.1:2375/info2, Intellij IDEA install Docker plug-in
Open Idea, enter the plug-in installation interface from File- > Settings- > Plugins- > Install JetBrains plugin, type docker in the search box, you can see Docker integration, and click the Install button on the right to install. Restart Idea after installation.
Configure docker to connect to the remote docker service after reboot. Open the configuration interface from File- > Settings- > Build,Execution,Deployment- > Docker.
3. Spring boot service Docker deployment
3.1 create a new Spring boot project and write test interfaces
3.2 modify pom file, add properties, add plugin
1.8 bozai org.springframework.boot spring-boot-maven-plugin com.spotify docker-maven-plugin 1.0.0 ${docker.image.prefix} / ${project.artifactId} / ${project.build.directory} ${project.build.finalName} .jar
Configure Dockerfile file: create a new Dockerfile file under the root directory of the project.
Content, as follows:
FROM java:8VOLUME / tmpCOPY target/demo-0.0.1-SNAPSHOT.jar demo.jarRUN bash-c "touch / demo.jar" EXPOSE 8080ENTRYPOINT ["java", "- jar", "demo.jar"] 4. Create a Docker image
Package the project, execute the mvn clean package command in idea Terminal to compile and package, and then generate the jar package in the target directory. After you generate the jar package, you can start the service locally for testing. After testing, configure the docker mirror assembly command. Enter the configuration interface from Run- > Edit Configrations.
Click Docker, then click the + sign, add a docker command, enter Name, select Server, select Dockerfile file, enter image tag, and complete the configuration.
When you are finished, execute this command:
After the successful execution, you can see the mirror on the remote docker:
If you execute docker ps, you can see that the image is already running in the production container:
Open a browser and access the test:
At this point, I believe you have a deeper understanding of "how to deploy Intellij IDEA to quickly achieve Docker images". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.