To create a Docker mirror instance of a Web project explain _docker

Source: Internet
Author: User
Tags mkdir mongodb tomcat docker run

Recently done a project to create a Web project Docker mirror image, after some toss finally made out, here record, also hope that the reader can go a little detour! The following is the data collation!

Supplierprofile Project based on Java,mongodb,tomcat

Disable SELinux

VI Etc/selinux/config
Selinux=disabled
selinuxtype=targeted

Running Mirrors

Docker run-i--privileged=true-v/home/centos:/usr/local/file-d-P 80:8080--name SP1 Centos/bin/bash

Go to mirror

Docker exec-it 7bd1d90c7d98/bin/bash

To the file path

Cd/usr/local/file

Extract MongoDB Files

TAR-VXF mongodb-linux-x86_64-3.2.0.tgz

New service Path

Mkdir/usr/local/server

Moving MongoDB files

MV Mongodb-linux-x86_64-3.2.0/usr/local/server/mongodb

Creating MongoDB Data files

Mkdir/usr/local/mongodb
Mkdir/usr/local/mongodb/data
Touch/usr/local/mongodb/logs

Set up startup

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 MongoDB

/usr/local/server/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--fork--logpath=/usr/local/mongodb/logs

[Success log] about
to fork the child process, waiting until server was ready for connections.
Forked process:40 Child
process started successfully, parent exiting

Decompression Tomcat

TAR-VXF apache-tomcat-8.0.30.tar.gz

Move Tomcat files

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 Tomcat

/usr/local/server/tomcat/bin/startup.sh

Host machine Browse URL, confirm success

Http://127.0.0.1/supplierprofile/profile.rpc

Generating Mirrors

Docker commit 7bd1d90c7d98 Itmaoo/sp

viewing mirrors

Docker images

Submit Mirror

Docker Push ITMAOO/SP

Thank you for reading, I hope to help you, thank you for your support for this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.