Docker 安装bookstack

Docker 安装bookstack(环境centos)

docker 安装自行百度
yum install -y docker

MYSQL安装

#拉取镜像
docker pull mysql
#创建数据存放位置
mkdir -p /var/own/datadir
mkdir -p /var/own/conf
#在/var/own/conf新建my.cnf并填写内容
vi my.cnf
#创建mysql容器
docker run --name mysql -p 3307:3306 -v /var/own/conf:/etc/mysql/conf.d -v /var/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
#默认已经开启用户远程登录,进入容器方法
docker exec -it mysql bash

my.conf

# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
secure-file-priv= NULL
default-time-zone = '+8:00'

#最大链接数
max_connections=1024

#是否对sql语句大小写敏感,1表示不敏感
lower_case_table_names=1
log_bin_trust_function_creators=1
#启用log-bin
log-bin=mysql-bin

#设置日志格式
binlog_format=mixed

#设置binlog清理时间
expire_logs_days=7

# 数据表默认时区
default-time-zone='+08:00'

# Custom config should go here
!includedir /etc/mysql/conf.d/

bookstack安装

docker pull solidnerd/bookstack
# 远程连接mysql,创建bookstack数据库(docker中mysql -p 3307:3306)
# 注意3307 为宿主机访问虚拟机的端口(虚拟机端口),这个没影响 DB_HOST,因为docker使用为默认网络docker0,所以DB_HOST直接使用container_id访问即可
docker run -d --name bookstack -e DB_HOST=mysql -e DB_PORT=3306 -e DB_DATABASE=bookstack -e DB_USERNAME=root -e DB_PASSWORD=123456 -p 80:8080 solidnerd/bookstack

宿主机访问URL: http://虚拟机:端口/ (http://192.168.56.101)
账户/密码 admin@admin.com/password

posted @ 2023-10-20 16:20  一个小笨蛋  阅读(230)  评论(0编辑  收藏  举报