- 拉取mysql8的镜像并运行
docker pull mysql
docker run -d -v /data/mysql/data:/var/lib/mysql -v /data/mysql/conf:/etc/mysql/conf.d --name mysql -e TZ=Asia/Shanghai -e MYSQL_ROOT_PASSWORD=1234 -p 3306:3306 mysql:latest
- 进入mysql,创建并修改权限
docker exec -it mysql bash
mysql -uroot -p
use mysql;
create user 'wiki'@'localhost' identified by '1234';
create user 'wiki'@'%' identified by '1234';
create database `wiki`;
grant all privileges on wiki.* to 'wiki'@'localhost';
grant all privileges on wiki.* to 'wiki'@'%';
flush privileges;
select host,user,authentication_string,plugin from user;
alter user 'wiki'@'%' identified with mysql_native_password by '1234';
Tips: 不要花太多时间尝试mysql workbench连接,因为第一需要最新的版本,第二还要折腾password plugin的问题,不然mysql workbench建立连接老是报错
- 拉取wiki.js镜像并运行
docker pull requarks/wiki
docker run -d -p 8080:3000 --name wiki --restart unless-stopped -e "DB_TYPE=mysql" -e "DB_HOST=172.17.0.1" -e "DB_PORT=3306" -e "DB_USER=wiki" -e "DB_PASS=1234" -e "DB_NAME=wiki" requarks/wiki:latest
Tips: 一定要填写DB_HOST格式是IP地址,之前掉坑里了
- 打开浏览器
http://localhost:8080
尝试wiki.js吧
(不知为何我的VM里面跑,慢的很。。。:S)