【docker构建】基于docker构建discuz论坛

下载discuz的zip包,将discuz论坛包解压:

 

wget  http://ahdx.down.chinaz.com/201712/Discuz_X3.4_SC_UTF8_0101.zip

 

编写Dockerfile:

 

[root@tanbaobao discuz]# cat Dockerfile 
FROM php:apache-stretch
MAINTAINER tanbaobao 2360415871@qq.com
COPY ./upload/ /var/www/html
RUN cd /usr/local/bin \
    && ./docker-php-ext-install pdo_mysql \
    && ./docker-php-ext-install mysqli \
    && cd /var/www/html/ \
    && chmod a+w -R config data uc_server/data uc_client/data \
    && rm -rf /var/lib/apt/lists/*
EXPOSE 80

 

目录内容:

 

新建docker-compose.yml文件:

 

[root@tanbaobao discuz]# vi docker-compose.yml

version: "3"
services:
    discuz:
      build: .
      image: discuz:3.4
      ports:
        - "88:80"
      restart: always
      depends_on:
        - mysql
      networks:
        - webnet
    mysql:
      image: mysql
      command: --default-authentication-plugin=mysql_native_password
      environment:
        - MYSQL_ROOT_PASSWORD=discuz!
      ports:
        - "13306:3306"
      restart: always
      networks: 
        - webnet
networks:
    webnet:

 

运行容器:

[root@tanbaobao discuz]# docker-compose up -d

执行之后说是需要先执行下docker-compose build之后再执行 docker-compose up -d

这里应该也可以使用一条命令:docker-compose up -d --build

执行完成之后,查看容器状态:

 

浏览器访问ip:88端口:

确认全部为ok才可以执行下一步:

配置数据库:

 

posted @ 2019-12-26 18:13  HeiDi_BoKe  阅读(1607)  评论(0编辑  收藏  举报