In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Docker can build java container, I believe many inexperienced people can do nothing about it, for this reason this article summarizes the causes and solutions of the problem, through this article I hope you can solve this problem.
Can docker build java containers? Docker container can install Java development environment, first make sure that the machine has installed docker container and other software, that is, enter docker version in the console, docker version will appear. Need to install jdk, tomcat, nginx, installation package to the official website download on the line.
install the JDK
Extract JDK package:
tar -zxf jdk-7u71-linux-x64.tar.gz -C
If it's an rpm packet
rpm -ivh jdk-7u71-linux-x64.tar.gz
Then rename the folder
mv jdk1.7.0_71/ jdk/
Final configuration environment variables
vi ~/.bashrc
Add the following configuration at the end of the file:
export JAVA_HOME=/opt/jdkexport PATH=$PATH:$JAVA_HOME
Open/etc/profile with a text editor
Add at the end of the profile:
export JAVA_HOME=/usr/share/jdk1.6.0_14export PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$ JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Finally, use the source command to make the environment variable take effect:
source ~/.bashrcsource /etc/profile
Install Tomcat
Extract Tomcat package:
tar -zxf apache-tomcat-7.0.55.tar.gz
Then rename the Tomcat directory:
mv apache-tomcat-7.0.55/ tomcat/
Write a script to run when the container is started and start Tomcat. The process is as follows:
vi /root/run.sh
Then edit the script as follows:
#!/ bin/bashsource ~/.bashrcsh /opt/tomcat/bin/catalina.sh run
Note: You must load the environment first and then run Tomcat using Tomcat's run script
Finally, add execute permissions for running scripts:
chmod u+x /root/run.sh
install Nginx
First go to the official website to download the source package, pay attention to if gz
After downloading, extract the installation package:
tar -zxvf nginx-1.11.5.tar.gz
Then configure the installation variables, open the decompressed directory-execute the command
cd nginx-1.11.5
Finally, configure the installation environment, submit the Docker image, and start the container.
After reading the above, do you know how docker can build java containers? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
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.