将discuz论坛的zip包解压之后用tar包压缩,这样ADD可以直接解压tar包。

[root@localhost centos6.9_ssh_discuz]# pwd
/opt/dockerfile/centos6.9_ssh_discuz
[root@localhost centos6.9_ssh_discuz]# ls
default.conf  discuz.tar.gz  Discuz_X3.4_SC_UTF8_0802.zip  dockerfile  init.sh、

[root@localhost centos6.9_ssh_discuz]# cat default.conf
server {
    listen       80 ;
    server_name  localhost;
    root         /code;
    index        index.php index.html index.htm;
    location / {
    }
    location ~ \.php$ {
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  /code$fastcgi_script_name;
         include        fastcgi_params;
     }
}
[root@localhost centos6.9_ssh_discuz]# cat init.sh
#!/bin/bash
service nginx start
service php-fpm start
service mysqld start
/usr/sbin/sshd -D
[root@localhost centos6.9_ssh_discuz]# cat dockerfile
FROM centos:6.9
RUN  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && \
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo && \
yum install  openssh-server nginx php-fpm  php-gd php-pecl-zendopcache php-mysqli mysql-server -y && \
service sshd start && \
echo "123456"|passwd --stdin root
ADD default.conf /etc/nginx/conf.d/default.conf
RUN mkdir /code
WORKDIR /code
ADD discuz.tar.gz .
RUN chmod -R 777 .  && \
mv upload/* . && \
service mysqld start && \
mysqladmin -uroot password '123456'
EXPOSE 22 80
ADD init.sh /init.sh
CMD ["/bin/bash","/init.sh"]

启动容器:
docker run -d -p 80:80 discuz:v1

打开网页测试:

可道云:

[root@localhost centos6.9_ssh_kode]# pwd
/opt/dockerfile/centos6.9_ssh_kode
[root@localhost centos6.9_ssh_kode]# ls
dockerfile  init.sh  kode.tar.gz  nginx.conf

[root@localhost centos6.9_ssh_kode]# cat dockerfile
FROM centos:6.9

RUN  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && \
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo && \
yum install nginx  php-mbstring php-fpm  php-gd    -y

ADD nginx.conf /etc/nginx/nginx.conf
RUN mkdir /code
WORKDIR /code
ADD kode.tar.gz .
RUN chown -R  apache.apache .
RUN chown -R  apache.apache /var/lib/nginx

EXPOSE
ADD init.sh /init.sh

CMD ["/bin/bash","/init.sh"]
[root@localhost centos6.9_ssh_kode]# cat init.sh
#!/bin/bash

service php-fpm start
nginx -g 'daemon off;'
[root@localhost centos6.9_ssh_kode]# cat nginx.conf
events {
      worker_connections  ;
}
 http {
      include    mime.types;
      default_type application/octet-stream;
      sendfile      on;
      keepalive_timeout  ;
server {
    listen        ;
    server_name  localhost;
    root         /code;
    index        index.php index.html index.htm;
    location / {
    }

    location ~ \.php$ {
         root           html;
         fastcgi_pass   ;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  /code$fastcgi_script_name;
         include        fastcgi_params;
     }
}
}

[root@localhost centos6.9_ssh_kode]# docker build --network=host -t kode:v2 .
10b8fcc6a31760c8f3982ab539640aca48c7054f904ce5266bee69d5c1b1e680
[root@localhost centos6.9_ssh_kode]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED              STATUS                 PORTS                NAMES
10b8fcc6a317        kode:v2              seconds ago        Up  seconds                 ->/tcp   unruffled_dewdney
[root@localhost centos6.9_ssh_kode]# docker  run -d -p : kode:v2

页面测试:

Dockfile自动创建discuz论坛和可道云的更多相关文章

  1. 用LAMP构架创建DISCUZ论坛

    # rpm -q httpd mariadb mariadb-server php php-mysql # yum -y install httpd mariadb-server php php-my ...

  2. java和Discuz论坛实现单点登录,通过Ucenter(用户管理中心)

    标题有点问题,没有进行修改. 一 Discuz论坛搭建步骤 1:服务器环境配置 服务器要支持php语言+支持mysql 5.0以上的数据库 + Apache服务器(支持网站的一个服务器,通过域名的能访 ...

  3. centos MySQL主从配置 ntsysv chkconfig setup命令 配置MySQL 主从 子shell MySQL备份 kill命令 pid文件 discuz!论坛数据库读写分离 双主搭建 mysql.history 第二十九节课

    centos  MySQL主从配置 ntsysv   chkconfig  setup命令  配置MySQL 主从 子shell  MySQL备份  kill命令  pid文件  discuz!论坛数 ...

  4. centos lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress 安装phpmyadmin 定时备份mysql两种方法 第二十五节课

    centos  lamp/lnmp阶段复习 以后搬迁discuz论坛不需要重新安装,只需修改配置文件即可 安装wordpress  安装phpmyadmin  定时备份mysql两种方法  第二十五节 ...

  5. Discuz论坛黑链清理教程

    本人亲测有效,原创文章哦~~~ 论坛黑链非常的麻烦,如果你的论坛有黑链,那么对不起,百度收录了你的黑链,不会自动删除,需要你手动去清理. 什么是黑链 黑链,顾名思义,就是一些赌博网站的外链,这些黑链相 ...

  6. Discuz论坛安全加固浅析

    [51CTO专稿]Discuz! 论坛以其功能完善.效率高效.负载能力,深受被大多数的网站喜爱和青睐.无独有隅,笔者所维护的论坛就是用discuz! 来构建的,从接手时候的7.2到现在x2.0,经历了 ...

  7. LNMP环境搭建(discuz论坛)

    一.操作系统级环境及软件版本 操作系统:CentOS release 6.5 (Final)minimal 内核版本:2.6.32-431.el6.x86_64 MySQL版本:MySQL-5.6.2 ...

  8. LAMP架构搭建+Discuz论坛搭建【weber出品必属精品】

    一.     本机简介: 本机系统: CentOS-6.4-x86_64 主机名:oracle.ywb IP地址:192.168.146.129 二.     在Linux环境下安装Apache步骤 ...

  9. Centos6.5下使用LAMP搭建discuz论坛(编译安装 PS :自学中 写的不好请见谅)

    wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.27.tar.gz  下载Apache软件包 wget http://downloads.my ...

随机推荐

  1. UML-如何画操作契约?

    1.在编写契约过程中,发现之前的领域模型不对,此时是否需要修改? 需要修改.包括:概念类.属性.关联.这就是不断迭代和进化 2.用例中复杂场景里的状态变化细节,描述过多导致用例臃肿,让人看不下去,因此 ...

  2. Django专题

    一.   web框架的原理: 1.C/S架构和B/S架构 C/S:客户端与服务器 B/S:浏览器与服务器     web开发 2.web开发的本质: socket服务端:收发消息都是按照HTTP协议的 ...

  3. 3.docker machine 连接 aliyun 远程docker 服务器

    1.在aliyun ecs 创建docker 服务器 docker-machine create -d aliyunecs machine-aliyunecs 2.远程连接 docker 获取客户端 ...

  4. 蓝桥杯 sine之舞(递归)

    Description 最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功.所以他准备和奶牛们做一个“Sine之舞”的游戏,寓教于乐,提高奶牛们的计算能力.不妨 ...

  5. <黑马新秀>Spring学习日志

    # 用于梳理Spring知识点 Spring是分层的Java EE应用全栈轻量级开源框架,以IoC(Inverse Of Control反转控制)和AOP(Aspect Oriented Progra ...

  6. TPO3-2Depletion of Ogallala Aquifer

    The vast grasslands of the High Plains in the central United States were settled by farmers and ranc ...

  7. python之web自动化测试框架

    梳理下搭建web自动化框架的流程: 创建目录: cases:存放测试用例,unittest框架要求用例名必须以test开头,所以命名test_case.py test_case.py代码如下:继承un ...

  8. Python2 和 Python3的区别 更新中

    py2和py3的区别 1.默认解释器编码 py2: ascii py3: utf-8 2.输入 输出 输入 py2: name = raw_input('请输入你的姓名:') py3: name = ...

  9. HDU-6708 Windows Of CCPC(打表,递归)

    http://acm.hdu.edu.cn/showproblem.php?pid=6708 Time Limit: 2000/1000 MS (Java/Others)    Memory Limi ...

  10. centos telnet

    yum install telnet yum install telnet-server