Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the implementation steps for deploying the java project runtime environment using docker

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about the implementation steps of using docker to deploy the running environment of the java project, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

I. Environmental preparation

1. CentOS-7-x86_64-DVD-2003.iso

2. Docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm

3. Emqx-4.2.6.tar

4. Influxdb-1.7-alpine.tar

5. Mysql-5.7.tar

6. Reids-6-alpine.tar

7. Xshell (connect centos7)

8. Xftp (upload files)

Second, configure the network

1. Switch directories

[root@localhost app] # cd / etc/sysconfig/network-scripts/ [root@localhost network-scripts] # lsifcfg-enp0s3

two。 Modify network profile configuration static ip

Modification item:

BOOTPROTO= "static"

New item:

IPADDR=192.168.1.153NETWORK=255.255.255.0GATEWAY=192.168.1.1HWADDR=08:00:27:3B:CE:45DNS1=114.114.114.114DNS2=192.168.1.1

Example of a profile:

TYPE= "Ethernet" PROXY_METHOD= "yes" BROWSER_ONLY= "no" BOOTPROTO= "static" yes "IPV4_FAILURE_FATAL=" no "IPV6INIT=" yes "IPV6_AUTOCONF=" yes "IPV6_DEFROUTE=" yes "IPV6_FAILURE_FATAL=" no "IPV6_ADDR_GEN_MODE=" stable-privacy "NAME=" enp0s3 "UUID=" d8a2c147-efe7-4913-a3aa-f63ffb62335e "DEVICE=" enp0s3 "ONBOOT=" yes "IPADDR=192.168.1.153NETWORK=255.255.255.0GATEWAY=192.168.1.1HWADDR=08:00:27:3B:CE: 45DNS1=114.114.114.114DNS2=192.168.1.1

3. Restart the network card

Service network restart

4. Verify that the network is open

Ping www.baidu.com III. Open ports

Open port command:

Firewall-cmd-zone=public-add-port=80/tcp-add-port=3306/tcp-add-port=6379/tcp-add-port=8081/tcp-add-port=1883/tcp-add-port=8083/tcp-add-port=8883/tcp-add-port=8084/tcp-add-port=18083/tcp add-port=8086/tcp permanent

Restart the firewall:

Systemctl restart firewalld.service

View all open ports:

Firewall-cmd-list-ports

Meaning of the command:

-- zone # scope

-- add-port=80/tcp # add port in the format: Port / communication protocol

-- permanent # is in effect forever. Without this parameter, it will expire after restart.

Fourth, install jdk

1. Extract the jdk installation package

Tar-zxvf jdk-8u261-linux-x64.tar.gz

two。 View jdk path

[root@localhost tool] # cd jdk1.8.0_261/ [root @ localhost jdk1.8.0_261] # pwd/opt/tool/jdk1.8.0_261

3. Configure environment variables

[root@localhost jdk1.8.0_261] # vi / etc/profile

Add the following configuration at the end of the profile file (press key I to enter edit mode,: wq save and exit)

# javaexport JAVA_HOME=/opt/tool/jdk1.8.0_261export PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib

4. Make the configuration effective and verify

[root@localhost jdk1.8.0_261] # source / etc/profile [root@localhost jdk1.8.0_261] # java-versionjava version "1.8.0mm 261" Java (TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot (TM) 64-Bit Server VM (build 25.261-b12, mixed mode) 5. Install docker

1.yum install docker

Yum install-y docker-ce-18.03.0.ce-1.el7.centos.x86_64.rpm

two。 Start docker, set boot and verify

[root@localhost tool] # systemctl start docker.service [root@localhost tool] # systemctl enable docker.serviceCreated symlink from / etc/systemd/system/multi-user.target.wants/docker.service to / usr/lib/systemd/system/docker.service. [root@localhost tool] # docker versionClient: Version: 18.03.0-ce API version: 1.37 Go version: go1.9.4 Git commit: 0520e24 Built: Wed Mar 21 23:09:15 2018 OS/Arch: Linux/amd64 Experimental: false Orchestrator: swarmServer: Engine: Version: 18.03.0-ce API version: 1.37 (minimum version 1.12) Go version: go1.9.4 Git commit: 0520e24 Built: Wed Mar 21 23:13:03 2018 OS/Arch: linux/amd64 Experimental: false

3. Set up Image Accelerator

Sudo mkdir-p / etc/dockersudo tee / etc/docker/daemon.json catalina.out 2 > & 1 & after reading the above, do you have any further understanding of the implementation steps for deploying the java project runtime environment using docker? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report