将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. texshop 使用技巧

    mac osX上使用latex 的技巧 指定编译器, 通过宏定义, 也就是在文件开头, 加上类似命令 % !TEX TS-program = pdflatex 多个文件设定主文件, 通过宏定义, 加上 ...

  2. 吴裕雄--天生自然深度学习TensorBoard可视化:projector_MNIST

    import os import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from te ...

  3. tensorflowlite 分类模型从训练到安卓部署

    https://blog.csdn.net/qq_33200967/article/details/82773677

  4. python3.6内置模块——random详解

    python内置模块random是用来生成随机数的,在许多场合都能应用到,算是比较常见的一种模块吧,下面详细介绍其具体用法. 基本用法 随机生成浮点数:有两种,一种没有参数,默认是0~1,另一种可以指 ...

  5. centos 7.2 php7+ 安装elasticsearch

    安装 Elasticsearch-php 的安装需要满足以下 4 个需求: PHP 7.0.0 或更高版本 Composer ext-curl:PHP 的 Libcurl 扩展(详情查看下方注意事项) ...

  6. Matlab高级教程_第四篇:Matlab高级函数_关键词:drawnow,addpoints,animatedline,getpoints

    0. MATLAB真实航母基本的工具,其中的函数/工具不计其数,而且有些函数/工具非常的炫酷.在MATLAB第四篇章把平时工作中用到的些许函数进行使用的讲解 主题1.:drawnow 解释:更新图窗并 ...

  7. python文件读写 文件修改

    #设置一个变量f为文件对象,并打开文件#写文件#f = open('user.txt','w',encoding='utf-8') #f是一个文件对象f=open(r'c:\Users\PL\Desk ...

  8. column命令

    grep -E "car_flag|feaname" s_35926_uid_psi_table_20170407.csv | column -t -s, -o'|'

  9. set theory

    set theory Apart from classical logic, we assume the usual informal concept of sets. The reader (onl ...

  10. 新年在家学java之基础篇--循环&数组

    因为“野味肺炎”的肆虐,过年被迫宅家只能吃了睡.睡了吃.这么下次只能长膘脑子空空,不如趁此机会重新学习java基础,为日后做铺垫~ 循环结构: 几种循环:for(::),while(){},do{}w ...