使用Discuz和数据库容器搭建论坛服务。
[root@localhost ~]# docker pull tencentci/discuz #拉取discuz镜像
Using default tag: latest
latest: Pulling from tencentci/discuz
d599a449871e: Pull complete
1a363f133ddd: Pull complete
dd6ffd5f60d7: Pull complete
515e48bcd87c: Pull complete
c6f3d43db193: Pull complete
f1c6f8e807f6: Pull complete
65d8fe3b5a08: Pull complete
80429671c76c: Pull complete
053b8d72a5a3: Pull complete
deb7baf580dc: Pull complete
8201b8a6c5c5: Pull complete
689e9b2c72d1: Pull complete
50557b0d5d8a: Pull complete
9beee0a5f923: Pull complete
97139e44b116: Pull complete
563f74e42351: Pull complete
Digest: sha256:b2d9f7cfde768d844fef738a6e1bb4dc5675bddf2565f296d7b76d1eabfd0218
Status: Downloaded newer image for tencentci/discuz:latest
docker.io/tencentci/discuz:latest
[root@localhost ~]#
[root@localhost ~]# docker pull mysql:5.7 #拉取mysql5.7版本镜像
5.7: Pulling from library/mysql
72a69066d2fe: Already exists
93619dbc5b36: Already exists
99da31dd6142: Already exists
626033c43d70: Already exists
37d5d7efb64e: Already exists
ac563158d721: Already exists
d2ba16033dad: Already exists
0ceb82207cd7: Pull complete
37f2405cae96: Pull complete
e2482e017e53: Pull complete
70deed891d42: Pull complete
Digest: sha256:f2ad209efe9c67104167fc609cca6973c8422939491c9345270175a300419f94
Status: Downloaded newer image for mysql:5.7
[root@localhost ~]#
[root@localhost ~]# docker run --name mysql -d -P -e MYSQL_ROOT_PASSWORD=123 mysql:5.7 #后台运行mysql5.7版本容器,设置用户名root密码123
1c9e4a739fc5b5b3ee5580c11c211b50614503879643eb6d38bf5cd1a7a1a9d1
[root@localhost ~]# docker ps #查看容器进程ID及端口
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1c9e4a739fc5 mysql:5.7 "docker-entrypoint.s…" 56 seconds ago Up 55 seconds 0.0.0.0:32779->3306/tcp, 0.0.0.0:32778->33060/tcp mysql
409d5fb63c33 tencentci/discuz:latest "docker-php-entrypoi…" 2 hours ago Up 2 hours 0.0.0.0:32769->80/tcp, 0.0.0.0:32768->443/tcp focused_brahmagupta
[root@localhost ~]# docker exec -it 1c9 bash #进入mysql容器
root@1c9e4a739fc5:/#
root@1c9e4a739fc5:/# mysql -uroot -p #登陆root用户
Enter password:welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> create database luntan; #创建luntan数据库
Query OK, 1 row affected (0.00 sec)mysql> grant all on *.* to 'root@%' identified by '123'; #授权登录
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges; #刷新权限表
Query OK, 0 rows affected (0.00 sec)mysql>
通过浏览器输入本机IP及端口
开始安装论坛