Docker项目部署lnmp+wordpress

Posted 还行少年

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker项目部署lnmp+wordpress相关的知识,希望对你有一定的参考价值。

一、环境

主机名              系统            IP
docker-lnmp        centos7         192.168.30.7
[root@localhost ~]# hostnamectl set-hostname docker-lnmp   //修改主机名
[root@localhost ~]# su

[root@docker-lnmp ~]# 
[root@docker-lnmp ~]# cat /etc/resolv.conf   //查看DNS

nameserver 114.114.114.114
search localdomain
[root@docker-lnmp ~]# ping www.baidu.com      //测试网络连通性
PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data.
64 bytes from www.baidu.com (180.101.49.12): icmp_seq=1 ttl=128 time=4.88 ms
64 bytes from www.baidu.com (180.101.49.12): icmp_seq=2 ttl=128 time=6.15 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 4.881/5.519/6.158/0.642 ms
[root@docker-lnmp ~]# getenforce    //查看核心防护是否关闭
Disabled
[root@docker-lnmp ~]# systemctl status firewalld   //查看防火墙是否关闭
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@docker-lnmp ~]# 

二、部署

1.安装docker源

[root@docker-lnmp ~]# yum install -y yum-utils device-mapper-persistent-data lvm2  //安装所需要的包
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
软件包 device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 已安装并且是最新版本
软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 已安装并且是最新版本
无须任何处理

[root@docker-lnmp ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo  //添加阿里云的源
已加载插件:fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@docker-lnmp ~]# 

2.安装docker

[root@docker-lnmp ~]# yum install -y docker-ce   //安装社区版docker
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
软件包 3:docker-ce-20.10.8-3.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@docker-lnmp ~]# systemctl enable docker   //开机自启
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@docker-lnmp ~]# systemctl start docker    //启动
[root@docker-lnmp ~]# 

3.创建dockerfile目录

[root@docker-lnmp ~]# mkdir docker && cd docker

4.创建nginx-phpmysql目录

[root@docker-lnmp docker]# mkdir nginx mysql

5.创建nginx-dockfile

[root@docker-lnmp nginx]# cat Dockerfile 
FROM docker.io/centos:7
RUN yum -y update
RUN yum -y install gcc gcc-c++ openssl-devel openssl autoconf cmake autoconf zlib zlib-devel libtool pcre pcre-devel wget net-tools make
RUN groupadd  -g 900 nginx && useradd nginx -g nginx -s /sbin/nologin
ADD nginx-1.12.2 nginx-1.12.2
RUN cd /nginx-1.12.2/ && ./configure --prefix=/usr/local/nginx --with-http_dav_module  --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx
RUN cd /nginx-1.12.2/ && make && make install
RUN ln -s /usr/local/nginx/sbin/nginx  /usr/local/sbin/
RUN sed -i '1afastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;' /usr/local/nginx/conf/fastcgi_params
ADD nginx.conf /usr/local/nginx/conf/
ADD wordpress /usr/local/nginx/html/wordpress
ADD wp-config.php /usr/local/nginx/html/wordpress
RUN yum -y install gcc gcc-c++ libxml2-devel libcurl-devel openssl-devel bzip2-devel  openssl automake make autoconf libtool zlib-devel make pcre-devel wget net-tools
ADD libmcrypt-2.5.7 libmcrypt-2.5.7
RUN cd libmcrypt-2.5.7/&& ./configure --prefix=/usr/local/libmcrypt && make && make install
ADD php-5.5.38 php-5.5.38
RUN  cd php-5.5.38/ && ./configure --prefix=/usr/local/php5.5 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts && make && make install
RUN  cd php-5.5.38 && cp php.ini-production /etc/php.ini
RUN  cd /php-5.5.38 && cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
RUN  chmod +x /etc/init.d/php-fpm && chkconfig --add php-fpm && chkconfig php-fpm on
RUN  cp /usr/local/php5.5/etc/php-fpm.conf.default  /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's*;pid = run/php-fpm.pid*pid = run/php-fpm.pid*g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/user = nobody/user = nginx/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/group = nobody/group = nginx/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.max_children = 5/pm.max_children = 50/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.start_servers = 2/pm.start_servers = 5/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 30/g' /usr/local/php5.5/etc/php-fpm.conf
EXPOSE 9000
EXPOSE 80

6.Docker部署nginx-php

[root@docker-lnmp nginx]# docker build -t "centos:nginx-php" .  //构建nginx-php镜像
Successfully built 49937451198f
Successfully tagged centos:nginx-php

[root@docker-lnmp nginx]# docker images  //列出镜像
REPOSITORY   TAG         IMAGE ID       CREATED          SIZE
centos       nginx-php   49937451198f   48 minutes ago   1.5GB
centos       7           8652b9f0cb4c   9 months ago     204MB
[root@docker-lnmp nginx]# docker run -dit -p 80:80 -m 500m --memory-swap 1G 49937451198f /bin/bash  //容器能使用的内存和交换分区大小
f0e9ae37d111908a1e4542e3d53440d82514bc699761c2fa47a8ee1cef69be6c
[root@docker-lnmp nginx]# docker ps  //查看当前运行容器
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS         PORTS                                         NAMES
f0e9ae37d111   49937451198f   "/bin/bash"   2 minutes ago   Up 2 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 9000/tcp   adoring_chaplygin
[root@docker-lnmp nginx]# docker exec -it f0e9ae37d111 /bin/bash  //进入容器
[root@f0e9ae37d111 /]# nginx       //开启服务
[root@f0e9ae37d111 /]# exit
exit

7.创建mysql-Dockerfile

[root@docker-lnmp mysql]# cat Dockerfile 
FROM docker.io/centos:7
RUN yum -y install gcc gcc-c++ make autoconf make cmake wget
RUN groupadd mysql; useradd -r -M -u 3306 -s /sbin/nologin -g mysql mysql
RUN mkdir /usr/local/mysql; mkdir /data/mysql -pv
RUN yum install gcc gcc-c++ ncurses-devel bison bison-devel -y
RUN wget -c http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.29.tar.gz
RUN tar xf mysql-5.6.29.tar.gz -C /usr/local/src/
WORKDIR /usr/local/src/mysql-5.6.29
RUN cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DWITH-MYSQLD-LDFLAGS=-all-static -DWITH-CLIENT-LD-FLAGS=-all-static -DWITH_DEBUG=0 && gmake && gmake install
RUN chown -R root:mysql /usr/local/mysql/ && chown -R mysql:mysql /data/mysql
RUN chmod 755 /usr/local/src/mysql-5.6.29/scripts/mysql_install_db.sh
RUN /usr/local/src/mysql-5.6.29/scripts/mysql_install_db.sh --basedir=/usr/local/mysql --datadir=/data/mysql --no-defaults --user=mysql
RUN cp /usr/local/src/mysql-5.6.29/support-files/my-default.cnf  /etc/my.cnf
RUN cp /usr/local/src/mysql-5.6.29/support-files/mysql.server  /etc/init.d/mysqld
RUN chmod 775 /etc/init.d/mysqld && /etc/init.d/mysqld start
RUN echo -e '#!/bin/bash\\nexport PATH=$PATH:/usr/local/mysql/bin' >/etc/profile.d/mysql.sh
RUN source /etc/profile
EXPOSE 3306

8.Docker部署mysql

[root@docker-lnmp mysql]# docker build -t "centos:mysql-5.6" . //构建镜像
Successfully built 9f7abd48947c
Successfully tagged centos:mysql-5.6

[root@docker-lnmp mysql]# docker images   //列出本地镜像
REPOSITORY   TAG         IMAGE ID       CREATED         SIZE
centos       mysql-5.6   9f7abd48947c   8 minutes ago   5.23GB
centos       nginx-php   49937451198f   2 hours ago     1.5GB
centos       7           8652b9f0cb4c   9 months ago    204MB
[root@docker-lnmp mysql]# docker run -dit -p 3306:3306 --device-write-bps /dev/sda:10M 9f7abd48947c /bin/bash   //限制Mysql容器写 /dev/sda 的速率为 10 MB/s
471b16b80432ed07fc5cc58a52626e3ff8b526b41f2c6ef020c48b7525abb3b1
[root@docker-lnmp mysql]# docker ps   //列出当前运行容器
CONTAINER ID   IMAGE          COMMAND       CREATED          STATUS          PORTS                                         NAMES
471b16b80432   9f7abd48947c   "/bin/bash"   7 seconds ago    Up 7 seconds    0.0.0.0:3306->3306/tcp, :::3306->3306/tcp     strange_ride
f0e9ae37d111   49937451198f   "/bin/bash"   59 minutes ago   Up 59 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 9000/tcp   adoring_chaplygin
[root@docker-lnmp mysql]# docker exec -it 471b16b80432 /bin/bash  //进入容器
[root@471b16b80432 mysql-5.6.29]# /etc/init.d/mysqld start  //启动mysql
Starting MySQL............ SUCCESS! 

9.进入数据库授权

[root@471b16b80432 mysql-5.6.29]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \\g.
Your MySQL connection id is 6
Server version: 5.6.29 Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.

mysql> create database wordpress default charset utf8 COLLATE utf8_general_ci;   //创建库
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on wordpress.*  to 'wordpress'@'%' identified by '123456' with grant option;   //提权
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

测试

三、备份

1.将所有容器快照

[root@docker-lnmp nginx]# docker images   //列出当前镜像
REPOSITORY   TAG         IMAGE ID       CREATED        SIZE
centos       mysql-5.6   9f7abd48947c   2 hours ago    5.23GB
centos       nginx-php   49937451198f   4 hours ago    1.5GB
centos       7           8652b9f0cb4c   9 months ago   204MB
[root@docker-lnmp nginx]# docker ps    //列出当前容器
CONTAINER ID   IMAGE          COMMAND       CREATED       STATUS          PORTS                                         NAMES
471b16b80432   9f7abd48947c   "/bin/bash"   2 hours ago   Up 45 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp     strange_ride
f0e9ae37d111   49937451198f   "/bin/bash"   3 hours ago   Up 44 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 9000/tcp   adoring_chaplygin
[root@docker-lnmp nginx]# docker export 471b16b80432 > test.tar   //快照
[root@docker-lnmp nginx]# docker export f0e9ae37d111  > test1.tar
[root@docker-lnmp nginx]# cat test1.tar | docker import - centos:new   //导入
sha256:294ec6eeecf7033e5aeaebf74af10dfc674a9e46036dda22fc4f26d60af8bf5c
[root@docker-lnmp nginx]# docker images
REPOSITORY   TAG         IMAGE ID       CREATED         SIZE
centos       new         294ec6eeecf7   5 seconds ago   1.12GB
centos       latest      e21f68845c4e   4 minutes ago   3.93GB
centos       mysql-5.6   9f7abd48947c   2 hours ago     5.23GB
centos       nginx-php   49937451198f   4 hours ago     1.5GB
centos       7           8652b9f0cb4c   9 months ago    204MB
[root@docker-lnmp nginx]# 

2.将镜像保存成tar包

[root@docker-lnmp ~]# docker images
REPOSITORY   TAG         IMAGE ID       CREATED         SIZE
centos       new         294ec6eeecf7   4 minutes ago   1.12GB
centos       latest      e21f68845c4e   8 minutes ago   3.93GB
centos       mysql-5.6   9f7abd48947c   2 hours ago     5.23GB
centos       nginx-php   49937451198f   4 hours ago     1.5GB
centos       7           8652b9f0cb4c   9 months ago    204MB
[root@docker-lnmp ~]# docker save -o mysql.tar centos:mysql-5.6   //镜像打包
[root@docker-lnmp ~]# docker save -o nginx-php.tar centos:nginx-php


[root@docker-lnmp ~]# docker ps
CONTAINER ID   IMAGE          COMMAND       CREATED       STATUS             PORTS                                         NAMES
471b16b80432   9f7abd48947c   "/bin/bash"   2 hours ago   Up About an hour   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp     strange_ride
f0e9ae37d111   49937451198f   "/bin/bash"   3 hours ago   Up About an hour   0.0.0.0:80->80/tcp, :::80->80/tcp, 9000/tcp   adoring_chaplygin
[root@docker-lnmp ~]# docker stop f0e9ae37d111   //停止容器
f0e9ae37d111
[root@docker-lnmp ~]# docker rm f0e9ae37d111     //删除容器
f0e9ae37d111
[root@docker-lnmp ~]# docker ps
CONTAINER ID   IMAGE          COMMAND       CREATED       STATUS             PORTS                                       NAMES
471b16b80432   9f7abd48947c   "/bin/bash"   2 hours ago   Up About an hour   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp   strange_ride
[root@docker-lnmp ~]# docker rmi 49937451198f  //删除镜像
Untagged: centos:nginx-php
Deleted: sha256:49937451198f4a55b6b87aebc0fef871f8b8bfc3b8896c36898a2d657b7151a7
Deleted: sha256:798beb69684dcc0e68ea2da81f840abe5071269921da5323ab3066254de05cae
Deleted: sha256:1e1a390be892101a130bcacb69f9ea5b3baced89ef6c25bd285090ed10f2df71
Deleted: sha256:d47fd147128ce948ebaa92ad5e1b7d34fbd292e4c020dcd5402625c491394ea1
Deleted: sha256:c95e0953ee20aa4fba29836600036d75d537d6bfc141edf776693e185fbefd1d
Deleted: sha256:3ca74aab4cfdb808c33252da6f785385187e9519a1dc0d591e7da997e0fd1e0c
Deleted: sha256:f0ea9bb50c77f53010de59dcb9175e56be9a63e526b8af0aa43fdbefc3df9408
Deleted: sha256:48b267dfde5da157154234169e3b46b76f600ae8341277ccabd0a8f97c059528
Deleted: sha256:544c76a2a560449e1c6dcc55d4fbcbea83fa199cc163a25d905d4b0e233c71cc
Deleted: sha256:ae4a6f8426d1ecdb5701f2abb0f439bbecb7e240e975e1435d648e4e3ac2ea98
Deleted: sha256:9a73005ed0401547c197cc2ac1b04f3955f64f9d51773c3f6f23f701f6de8d26
Deleted: sha256:1f247e97b6408e0b13ae0a2cfd695c536f66b1185830b48507b55fcdae798370
Deleted: sha256:84cd37ec1affe70bdb4aae22f51e7e4b48bfd14f4f799a5a80d9db5493916437
Deleted: sha256:28f89e253a336575c99df2e102a7770a34261427d5640f95447eb231610916b5
Deleted: sha256:8e4a5927ff8357e3e2a516083823e20569a83199d55e1be31220a1a343574349
Deleted: sha256:d5595b052df4b399f659280d2e94c7c55c926b09f02c9f41436234a07b0d16f2
Deleted: sha256:2c18ebcc39f46f92e38c064ecf845fb3403497ddabd7cfc95a26d4ac3685a62a
Deleted: sha256:6316a4b40982a50e082efbdca3de15ae2119b28e02975921038ca8f3a66cc353
Deleted: sha256:03d4b4757a2cfe5712a186e38e68e63bd9082e3fa7182ad9972c3841484b3923
Deleted: sha256:0aac80401195082232b14788f15c1e94f8349df729dc9f276a00a15704266d11
Deleted: sha256:52f720b089128529f70b44483f501988fd5612e8678234e0f908b9809ab781a0
Deleted: sha256:89244a06f844354cd8bfda268911e72f0cada7cebecfe8ecb276d606b9cae1cd
Deleted: sha256:3bd4f1a60c5f36646bc970c51f8a0c9c7dc358b2395e5d88753b9d10f1179b7f
Deleted: sha256:e08548779292218b1bd39f02a7c1a600c275a84edb7593e4f369b949884ee1e1
Deleted: sha256:08797ee2d117ba0fd78d7b0336048e1856c2665e431f6b8995212d85d7436690
Deleted: sha256:1ae0ff23af45211c9bddfa7983778b7540d3e25377a9874544928bca898b39d6
Deleted: sha256:8262b1c25d180d23cef3d2363a7943761f585662d811ee5cd6270602d4315e15
Deleted: sha256:f1d2400b8bf814f6934b70b330e605eb92577ed664e01d3c0ef5bedf93c7aaf2
Deleted: sha256:c7374622eb462a9f7316a70f78fc59832535b9f95dc85c88b5cbab8e852fa20f
Deleted: sha256:549aa9b7c1bfb51ccdaa8ac2c7369fbc0f1a6435326cb3ea5d84fb109a575821
Deleted: sha256:d5edab69a51a60c221a890e0b8e8ef96cc438b8f145c9cc059c76aa9ef07c77e
Deleted: sha256:3f5f37171d38522a21edf3f5cf4b1a5d8bd12fec6d8aa1979f7f683f3b7d89d6
Deleted: sha256:d3f19941df2e08fbbcc54f7dbd05e0f8e77a91ec47164fb979cd6ab25a1d2017
Deleted: sha256:3dffe8ed4c7f3e32e77ace738f8ffbfb220ba2502229547e7dc6cae0409749c1
Deleted: sha256:4d175d855a41333458027f97e9bb90679c7ed494f5cd300d8c99ce231f1724c7
Deleted: sha256:e29a6dbf9ae501b7ff938a8da7cbfde85cf1eeb726c9b67411a9666a381715c1
Deleted: sha256:836a6adf7d95ae01eb8218d2d5d64ade82f5d2c935ad9128df96a2bcbbfa1ac0
Deleted: sha256:476602113db6ab77e6bbe86e0732b55ae2f11a4310f8bc0a272efc4710eac1e3
Deleted: sha256:6205fe26be270e1337ca88c4a173f89e89fc89ef7c46ec19414eba7a86825439
Deleted: sha256:d0757fbf0b7ab397901660ef32a24902b37e1df0aed7e4212ebe25e51cc930cd
Deleted: sha256:aee8e21b08f148547dff3172e5d59eb51298ebe2e0d0ce89c4a395e5f801dc89
Deleted: sha256:0420579f2da4d52aa9305f1b3be6c03367fafa6f94af23c463669e38231c06f5
Deleted: sha256:dcae663015338133e85e4df4ca50d8a7c02297da7f8b9e7518b7d2b616734126
Deleted: sha256:d2b397a9601e55575ddc2d3b05aa575cf41069492d62b8fb640b9c32e89e9bfc
Deleted: sha256:01113d337b2441529ec44f04ffdd8fd43a4867ae550a18c31885b49b1865fcef
Deleted: sha256:f42a93d770df014cb6fc6a1b62a2d7ca33cfb473a97ee96f7bf66509ea05efb5
Deleted: sha256:22ca3ca34a6e64eaddc7b2752774a533dd874af8fea0eb02130c345eecfccba8
Deleted: sha256:35ec1a1572b32269db94d3eada70b264e7d70bfff1c8cb8de232189cfa5d4844
Deleted: sha256:d1343865775c37013a79669d76a4c1f9c389595e60c88b86a46bf8784bc355de
Deleted: sha256:3ccd2b0c58292e4da156edf125b70e77daa5d8bc6d7b92e6a40b6b344a4e36c9
Deleted: sha256:6703dfd556ff9e3456269bf20ed762eeeeeb2449fc875b3ed55920743080204a
Deleted: sha256:f673938e8d4dc39dcf0479c0e746a9867e7a1c57604f1f256918272b782b97b3
Deleted: sha256:0ccd4c4d77c46310f0142824240125a06b72d8b2513c9dc52bb48815c5c7b174
Deleted: sha256:9c0ac58930250a6bc42ba840ab9dec1a40a55b08a047bd9a9ef24a27837344b6
Deleted: sha256:a5740803388d1ab2361ef6602e454da543f96ca658400f09c07c6a28f6c33e1a
Deleted: sha256:0a17232f20671952388946ad2a6cf23253a63f16cf4e2f0a490757ec7b0bf021
[root@docker-lnmp docker]# docker images
REPOSITORY   TAG         IMAGE ID       CREATED          SIZE
centos       new         294ec6eeecf7   24 minutes ago   1.12GB
centos       latest      e21f68845c4e   28 minutes ago   3.93GB
centos       mysql-5.6   9f7abd48947c   2 hours ago      5.23GB
centos       7           8652b9f0cb4c   9 months ago     204MB
[root@docker-lnmp docker]# 
[root@docker-lnmp ~]# docker load < nginx-php.tar  //恢复镜像
0b403d97ab8a: Loading layer [==================================================>]  241.9MB/241.9MB
f231d1996a4b: Loading layer [==================================================>]  272.6MB/272.6MB
89cdbbe04d33: Loading layer [==================================================>]  379.4kB/379.4kB
846f154783c2: Loading layer [==================================================>]   6.12MB/6.12MB
dd21710970bd: Loading layer [==================================================>]  87.55kB/87.55kB
329690c7f111: Loading layer [==================================================>]  26.74MB/26.74MB
0a5ba8b1b594: Loading layer [==================================================>]  3.072kB/3.072kB
ba7258957556: Loading layer [==================================================>]   5.12kB/5.12kB
7f201305f815: Loading layer [==================================================>]  6.656kB/6.656kB
abc924abe9e0: Loading layer [==================================================>]  29.44MB/29.44MB
352ef5be6541: Loading layer [==================================================>]  7.168kB/7.168kB
ced5b710d18c: Loading layer [==================================================>]  244.3MB/244.3MB
05045c051718: Loading layer [==================================================>]  2.288MB/2.288MB
f61fdd726223: Loading layer [==================================================>]   4.28MB/4.28MB
4db34a4bb9bd: Loading layer [==================================================>]  113.9MB/113.9MB
d5232d646e05: Loading layer [==================================================>]  380.2MB/380.2MB
cbc8332e3121: Loading layer [==================================================>]  71.68kB/71.68kB
399481a9f170: Loading layer [==================================================>]  5.632kB/5.632kB
c74bd30961e3: Loading layer [==================================================>]   12.8kB/12.8kB
7b5772e508e6: Loading layer [==================================================>]  26.62kB/26.62kB
b4bfdccd94bd: Loading layer [==================================================>]  26.62kB/26.62kB
0c16eb7a654d: Loading layer [==================================================>]  26.62kB/26.62kB
8c75d0d3c725: Loading layer [==================================================>]  26.62kB/26.62kB
765d12e5a98f: Loading layer [========================以上是关于Docker项目部署lnmp+wordpress的主要内容,如果未能解决你的问题,请参考以下文章

Dockerfile构建LNMP分离环境部署wordpress

docker部署lnmp-wordpress

Dockerfile构建LNMP分离环境部署wordpress

如何在lnmp上部署Thinkphp

LNMP架构环境之PHP+Mariadb环境项目:部署博客wordpress项目

使用docker lnmp镜像包部署搭建laravel项目