一、简介  

目的:使用Docker Swarm 搭建lnmp来部署WordPress

  1. 使用Dockerfile构建nginx、php镜像
  2. 将构建的镜像上传docker私有仓库
  3. 使用volume做workpress网站文件持久化(每个工作节点都要保存一份数据)
  4. 使用nfs共享存储做ngixn配置文件持久化(一份数据多个工作节点共享)
  5. mysql镜像直接从dockerhub中获取
  6. mysql的配置文件使用docker config创建(当然也可以用挂载的方式)
  7. mysql 数据使用volume数据卷持久化
  8. 启动是mysql--php--nginx

二、准备

  (1)如何创建私有仓库: http://www.cnblogs.com/bigberg/p/8821872.html   

# 已经创建好的私有库中的镜像
[root@manager ~]# curl http://172.16.60.95:5000/v2/_catalog
{"repositories":["busyboxx","nginx","php"]}

# 其中nginx和php是准备要用的 

  (2)Dockerfiel文件 

 1 FROM centos:latest
 2 MAINTAINER bigberg
 3 RUN yum -y install pcre-devel openssl-devel net-tools gcc gcc-c++ zlib zlib-devel \
 4     make openssl
 5 ADD nginx-1.12.1.tar.gz /tmp/
 6 RUN cd /tmp/nginx-1.12.1 \
 7     && ./configure --prefix=/usr/local/nginx \
 8      --with-http_ssl_module \
 9      --with-http_gzip_static_module \
10      --with-http_realip_module \
11     && make && make install
12 
13 ADD nginx.conf /usr/local/nginx/conf/nginx.conf
14 
15 RUN mkdir -p /usr/local/nginx/logs \
16     && mkdir -p /usr/local/nginx/conf/vhosts \
17     && groupadd -g 1001 nginx \
18     && useradd -g 1001 -u 1001 -s /sbin/nologin -M nginx
19 RUN cat /usr/share/zoneinfo/Asia/Shanghai > /etc/localtime
20 
21 EXPOSE 80
22 EXPOSE 443
23 CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
nginx-Dockerfile

相关文章:

  • 2022-01-13
  • 2021-09-23
  • 2021-10-07
  • 2021-12-26
  • 2021-12-30
  • 2022-02-08
猜你喜欢
  • 2021-10-11
  • 2021-07-14
  • 2021-12-29
  • 2021-05-25
  • 2021-06-25
  • 2021-06-22
  • 2022-03-09
相关资源
相似解决方案