1. Installation of JDK1.8 under CentOS7.0(1) Download jdk-8u291-linux-i586.tar.gz from Oracle official website. (2) Uninstall the system's own java java -version rpm -qa | grep java yum -y remove [the above found contents, multiple separated by spaces] (3) Install JDK mkdir /usr/java cd /usr/java tar -zxvf jdk-8u291-linux-i586.tar.gz (4) Configure environment variables vim /etc/profile Add the following content export JAVA_HOME=/usr/java/jdk1.8.0_291 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar Make environment variables effective source /etc/profile test java -version 2. Installation of Docker(1) Check the kernel version (Docker requires a 64-bit version and a kernel version above 3.10. If the version is lower than 3.10, you need to upgrade the kernel) uname -r (2) Update the yum package: yum update -y (3) Add the Alibaba Cloud yum repository: cd /etc/yum.repos.d/ wget "http://mirrors.aliyun.com/repo/Centos-7.repo" mv CentOS-Base.repo CentOS-Base.repo.bak mv Centos-7.repo CentOS-Base.repo Execute the update command of the yum source yum clean all yum makecache yum update (4) Install Docker yum install -y docker-ce (5) Start Docker systemctl start docker docker info You can set the startup item later systemctl enable docker (6) Configure Docker remote access to execute command editing files vim /usr/lib/systemd/system/docker.service Find this line ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Append -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock Restart the service service docker restart If the prompt file needs to be reloaded, execute systemctl daemon-reload Remote access testing http://192.168.2.200:2375/version 3.Docker uses the Maven plugin to build and upload images(1) Create a new Dockerfile Add a new folder docker under the project's /src/main, and create a Dockerfile file in the folder. The content of the file is as follows # Based on which image FROM java:8 # Mount the local folder to the current container VOLUME /tmp # Copy the file to the container, swaggertest-0.0.1-SNAPSHOT.jar here is the name after Maven packaging ADD swaggertest-0.0.1-SNAPSHOT.jar swaggertest.jar RUN bash -c 'touch /swaggertest.jar' # Configure the command to be executed after the container is started ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/swaggertest.jar"] EXPOSE 8080 (2) Modify the pom.xml file and add the following plugin <plugin> <!-- https://mvnrepository.com/artifact/com.spotify/docker-maven-plugin --> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.2</version> <configuration> <imageName>swaggertest-service</imageName> <dockerDirectory>src/main/resources/docker</dockerDirectory> <dockerHost>http://192.168.2.200:2375</dockerHost> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> Each microservice project needs to be configured. (3) Build the image and upload it to Docker mvn clean package docker:build -DskipTests After the upload is successful, enter docker images You can see the newly created Docker image. Start the current image docker run -p 8080:8080 swaggertest-service:latest This is the end of this article about installing docker under centos and how to remotely publish docker in springboot. For more information about installing docker under centos, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Pure CSS to achieve input box placeholder animation and input verification
>>: HTML tag overflow processing application
In the past, creating a printer-friendly version ...
Without going into details, let's go straight...
I encountered a problem when modifying the defaul...
XML/HTML CodeCopy content to clipboard < input...
Table of contents 1. Introduction 2. Simple defin...
I hope to implement some properties of the query ...
Theoretically, the memory used by MySQL = global ...
The specific code of the sliding button made with...
Using abbreviations can help reduce the size of yo...
ElementUI implements a table tree list loading tu...
1. Links Hypertext links are very important in HTM...
1. Check whether event is enabled show variables ...
First, download the diagram 1. First uninstall th...
Tutorial Series MySQL series: Basic concepts of M...
1. Call the parent component method directly thro...