Write in front:
After continuing with Docker's learning and learning the basic common commands of Docker, I installed jdk,tomcat two basic Java Web Tools on Docker, where the operating procedures were recorded.
Software Preparation:
1, jdk-7u79-linux-x64.tar.gz
2, apache-tomcat-8.0.36.tar.gz
Download CentOS Image: ( the process of downloading CentOS is very long )
1 # Start the Docker service 2 Service Docker start 3 4 # retrieving CentOS images 5 Docker Search CentOS 6 7 # download CentOS image 8 Docker pull CentOS
Create and run a container (Appcentos)
192.168. 0.105:8080:8080 -i-t -v/niloay/software/:/mnt/software--name appcentos CentOS
- p maps the 8080 port in the Docker container to the 192.168.0.105 8080 port (192.168.0.105 is the IP of the CentOS virtual machine in VirtualBox and the virtual machine uses bridging mode)
The-t option lets Docker assign a pseudo-terminal (pseudo-tty) and bind it to the container's standard input.
-I keeps the container's standard input open.
-V Mount the/niloay/software of the native (virtual machine) to the container's/mnt/software directory
The name of the--name container is Appcentos
CentOS is the image installed above
Copy the JDK compressed package and the Tomcat compression package to the/web directory:
# Create/web directory mkdir /web# copy jdkCP /mnt/software/jdk-7u79-linux-x64. Tar. GZ/web# copy tomcatCP /mnt/software/apache-tomcat-8.0. . tar. gz/web
To install the JDK:
Refer to my other blog, CentOS installation jdk,http://www.cnblogs.com/niloay/p/6258910.html
Install Tomcat: (Tomcat can be extracted directly)
tar zxvf apache-tomcat-8.0. 36. Tar. gz
To start Tomcat:
/web/apache-tomcat-8.0. 36/bin# start Tomcat. /start. SH # Check if successful curl HTTP is started: // localhost:8080
in the physical machine type access tomcat (the IP of the physical machine is the IP of the virtual machine in 192.168.0.101,virtualbox is 192.168.0.105, remember to turn off the virtual machine's firewall)
To turn off the firewall:
Service iptables Stop
Commit the changes here to the image and set the tag to V2
Not finished, to be continued ....
docker--Container Installation Tomcat