Docker consists of three concepts:
(1) The remote Repository is the aggregate of all the mirrors in the Remote Mirror Library (no entry operation).
(2) The local image is the image pulled from the remote repository.
(3) A local image is called a container (layered and operable).
Docker use:
1. First use the third-party Image Library (c.163.com) to pull the corresponding information such as CENTOS,UBUNTU,TOMCAT, etc. as the base image.
Docker pull xxxx
2. Run the downloaded image.
Docker run-dt-p host Port: Mirror Port--name a name Mirror ID/image name bash
-D Background Run
-T generates a pseudo terminal
-P Specify port
--name a name for the running container
3. There are two ways to enter the container
(1) Docker exec-it container name/container ID bash (Ctrl+d does not stop the running container when exiting)
(2) Docker attach container name/container ID (Ctrl+d will stop the running container when exiting)
4. Start downloading the appropriate tools and dependent packages required to compile the environment
(1) Yum installation wget and compiled tools Yum install-y wget gcc gcc-c++ make Openssl-devel
(2) Update the domestic yum source
Wget-o/etc/yum.repos.d/centos-base.repo http://mirrors.aliyun.com/repo/xxx/
XXX Indicates the Yum source you want to choose
-O download and save with a different file name
Centos-base.repo represents a named Yum source
(3) Download the Nginx version of each version
Wget http://nginx.org/download/xxx
XXX indicates the version of Nginx you want to select
(4) Download pcre
Ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/xxx
XXX indicates the selected version
(5) Update Yum to ensure the latest
Yum Update
(6) Download PHP7
http://php.net/downloads.php
Select a version, select a border
(7) Paste all the above downloaded items into/usr/local/src and unzip them all.
(8) Compile Nginx
(1) Create Nginx user
Groupadd-r Nginx
Useradd-r-G Nginx
(2) Compile and install Nginx
CD XXX switch to your nginx directory
./configure--prefix=/usr/local/nginx--user=nginx--group=nginx--with-http_ssl_module--with-http_stub_status_ Module--with-pcre=/usr/local/src/pcre-8.37
The./configure parameter Description:
--prefix= the installation directory for the specified file
--user= the specified user
--group Specifying user groups
--with-using existing packages and library files
Do && make install problem self-Baidu
echo "daemon off;" >>/usr/local/nginx/conf/nginx.conf #在nginx的配置文件里加上这一行很关键 so nginx can run in the background when Docker boots!
(9) Compiling PHP
(1) Preparing a PHP dependency package
Yum install-y Bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel libxml2-devel libcurl-devel bzip2-devel Rea Dline-devel Libedit-devel Sqlite-devel
(2) Enter the PHP file directory
(3) Start compiling PHP
./configure--prefix=/usr/local/php--with-zlib-dir--with-freetype-dir--enable-mbstring--with-libxml-dir=/usr/ Local/libxml--enable-soap--enable-calendar--with-curl--with-mcrypt--with-zlib--with-gd--disable-rpath-- Enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl- -enable-mbregex--enable-exif--enable-bcmath--with-mhash--enable-zip--with-pcre-regex--with-mysql-- With-pdo-mysql--with-mysqli--with-jpeg-dir=/usr/local/libjpeg--with-png-dir=/usr/local/libpng-- Enable-gd-native-ttf--with-openssl--with-fpm-user=www--with-fpm-group=www--with-libdir=lib64--enable-ftp-- With-imap--with-imap-ssl--with-kerberos--with-gettext--with-xmlrpc--with-xsl--enable-opcache--enable-fpm-- Enable-xml--enable-shmop--enable-session--enable-ctype--with-iconv-dir--with-iconv
Note: There is a problem self-Baidu.
(4) Make && make install
(5) Preparing the PHP configuration file
CP Php.ini-production/etc/php.ini
Cd/usr/local/php/etc
CP Php-fpm.conf.default php-fpm.conf
(6) Modify the configuration file
;d aemonize = yes to remove the comment and change yes to No
(7) Installation Yar expansion
(1) Install Binary Package protocol Msgpack
Find/-name phpize finding if phpize exists
Yum Install Php-devel
PECL Install Msgpack
Note: Problems arise self-Baidu
(2) Download Yar wget http://pecl.php.net/get/xxx
XXX indicates that the version is OK with the PHP version of this is very important.
(3) Unzip the compiled TAR-ZXVF yar-2.0.0.tgz
(4) CD CD yar-2.0.0
(5)/usr/bin/phpize
(6)./configure--with-php-config=/usr/bin/php-config7.0*
(7) Make && make install
(8) If the module is not installed can php--ini view ini path relative adjustment
(9) Docker commit-m "description"--"author" container ID Warehouse Information Mydocker/nginx: Version information v1
(ten) Docker save xxx >/home/save.tar
(one) Docker load xxx
If the compilation of errors in the installation process, according to the error prompts to use Yum to resolve the dependency relationship, if the current Yum source can not solve, then try:
wget http://www.atomicorp.com/installers/atomic
chmod +x Atomic
./atomic
Yum install-y xxx xxx
PHP7 installing Yar creating a docker image