In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "sample analysis of Docker deployment projects", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "sample Analysis of Docker deployment projects".
Environment ready for Docker installation startup
Check whether the system kernel meets version 3.10 or above:
Uname-r
Upgrade the kernel package:
Yum update
Install Docker using yum:
Yum install docker
Start Docker:
Systemctl start docker
View the Docker version:
Docker-vJava environment installation
Use Docker to install the environment for Java 8:
Docker pull java:8Docker remote access configuration
Open the docker.service file:
Vim / lib/systemd/system/docker.service
Add a listening port:
ExecStart=/usr/bin/dockerd-current-H tcp://0.0.0.0:2375-H unix:///var/run/docker.sockDocker restart
Reload the configuration file for Docker:
Systemctl daemon-reload
Restart Docker:
Systemctl restart docker
Check to see if there is a dockerd-current process:
Netstat-tulp
Use curl to see if the configuration of Docker takes effect:
Curl http://127.0.0.1:2375/infoIDEA configuration Docker
Open Docker under the path File- > Settings:
Configure the path address of Docker:
Project configuration
Configure the pom.xml file
Add the following configuration to the pom.xml file of the project:
Com.spotify docker-maven-plugin 1.0.0 build-image package build ${project.artifactId} latest ${project.baseDir} / src/main/resources http://192.168.6.66 : 2375 / ${project.build.directory} $ {project.build.finalName} .jar configuration Dockerfile file FROM java:8# mount directory VOLUME / tmpADD * .jar app.jar# exposes the port number EXPOSE 8083ENTRYPOINT ["java" "- Djava.security.egd=file:/dev/./urandom", "- jar", "/ app.jar"] Docker configures Maven packaging to generate Docker images
Use the clean and package commands in the Maven toolbar to package the project to generate a Docker image
Right-click on the generated Docker image and select Create Container to configure the Docker image. After the configuration is completed, click Run to start the Docker container:
The effect of launching the Docker container is as follows:
Access the project based on port name 8083 and project name oxford:
Http://127.0.0.1:8083/oxford Summary Linux Operation Command
View the status of the Linux firewall:
Service firewalld status
Turn off the Linux Firewall:
Service firewalld stopDocker operation command
Configure Docker Boot self-boot:
Systemctl enable docker
Stop the Docker service:
Systemctl stop docker
Start the Docker service:
Systemctl start docker
View all mirrors:
Docker images
Pull the image with the specified name:
#: tag is optional. Represents a label. Usually the version of the mirroring software. The default is latestdocker pull image name: tag
Delete the specified mirror:
Docker rmi image-id
View the running Docker container:
Docker ps
View all Docker containers, including running Docker containers and unrunning Docker containers:
Docker ps-a
Start the container:
Docker start container name / container ID
Stop the container:
Docker stop container name / container ID
Delete the container:
Docker rm Container ID
View the container log:
Docker logs container name / container ID
Runs the specified image in the specified Docker container:
#-- name means custom container name.-d means running docker run in the background-- name custom container name-d image name #-p indicates the container internal port docker run to which the host port is mapped-- name custom container name-d image name-p 8088 is above the name of the container. Thank you for reading this article "sample Analysis of Docker deployment Project"! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.