Create an Docker mirror instance tutorial for the Web project
- 2020-05-17 07:10:43
- OfStack
Recently, I made a project to create Docker mirror of web project. After 1 time of suffering, I finally made it. I will write it down here, and I hope readers can take less detours! The following is the data collation!
Supplierprofile project based on Java, Mongodb, Tomcat
Disable selinux
vi etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
Run the mirror
Docker run -i --privileged=true -v /home/centos:/usr/local/file -d -p 80:8080 --name sp1 centos /bin/bash
Into the mirror
docker exec -it 7bd1d90c7d98 /bin/bash
To file path
cd /usr/local/file
Unzip the mongodb file
tar -vxf mongodb-linux-x86_64-3.2.0.tgz
New service path
mkdir /usr/local/server
Move the mongodb file
mv mongodb-linux-x86_64-3.2.0 /usr/local/server/mongodb
Create the mongodb data file
mkdir /usr/local/mongodb
mkdir /usr/local/mongodb/data
touch /usr/local/mongodb/logs
Set the boot to start
echo "/ usr/local/server/mongodb bin/mongod - dbpath = / usr/local/mongodb/data � logpath = / usr/local/mongodb/logs � logappend - auth � port = 27017"
>
>
/etc/rc.local
Start the mongodb
/usr/local/server/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data --fork --logpath=/usr/local/mongodb/logs
[ Successful log ]
about to fork child process, waiting until server is ready for connections.
forked process: 40
child process started successfully, parent exiting
Unpack the tomcat
tar -vxf apache-tomcat-8.0.30.tar.gz
Move the tomcat file
mv apache-tomcat-8.0.30 /usr/local/server/tomcat
Mobile supplierprofile war
cp supplierprofile.war /usr/local/server/tomcat/webapps/
Install Java
yum install java -y
Start the tomcat
/usr/local/server/tomcat/bin/startup.sh
Host machine browsing URL, confirm success
http://127.0.0.1/supplierprofile/profile.rpc
Generate the mirror
docker commit 7bd1d90c7d98 itmaoo/sp
Look at mirror
docker images
Submit mirror
docker push itmaoo/sp
Thank you for reading, I hope to help you, thank you for your support of this site!