如何利用docker安装discuz
Discuz安装是依赖LAMP环境的。如何安装LAMP,有很多教程,里边涉及了很多繁琐的步骤。今天要简单介绍下利用docker安装discuz
1. 安装LAMP环境
在docker hub上找到一个已经封装好的lamp镜像,直接安装,代码如下:
# Launch a 16.04 (php5) based image
docker run -p “80:80” -v ${PWD}/app:/app mattrayner/lamp:latest-1604
# Launch a 14.04 (php5) based image
docker run -p “80:80” -v ${PWD}/app:/app mattrayner/lamp:latest-1404
# Launch a 16.04 (php7) based image
docker run -p “80:80” -v ${PWD}/app:/app mattrayner/lamp:latest-1604-php7
# Launch a 14.04 (php7) based image
docker run -p “80:80” -v ${PWD}/app:/app mattrayner/lamp:latest-1404-php7
Component | latest-1404-php5 |
latest-1604-php5 |
latest-1404-php7 |
latest-1604-php7 |
---|---|---|---|---|
Apache | 2.4.7 |
2.4.18 |
2.4.7 |
2.4.18 |
MySQL | 5.5.61 |
5.7.23 |
5.5.61 |
5.7.23 |
PHP | 5.6.37 |
5.6.37 |
7.2.9 |
7.2.9 |
phpMyAdmin | 4.8.2 |
4.8.2 |
4.8.2 |
4.8.2 |
地址:https://hub.docker.com/r/mattrayner/lamp
2. 下载discuz安装包
经过亲自测试,Discuz 3.3/3.4不支持php7,所以如果用php5,需要下载3.2的包
下载地址:
http://www.discuz.net/forum-10-1.html
3. 启动docker
docker run -p “80:80” -v ${PWD}/mysql:/var/lib/mysql -v ${PWD}/app:/app mattrayner/lamp:latest-1604-php7
docker run -p “80:80” -v ${PWD}/mysql2:/var/lib/mysql -v ${PWD}/app2:/app mattrayner/lamp:latest-1604
效果如下:
按上边的步骤,差不多10几分钟就可以搞定,省去了大量依赖环境的安装!