一、Dochub介绍
Dochub是一款使用Beego(Golang)开发的开源文库系统,支持所有office文档、epub、mobi、txt等多种格式文档在线浏览。
二、检查宿主机安装环境
1.检查系统版本
[root@docker ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
2.检查docker版本
[root@docker ~]# docker -v
Docker version 20.10.18, build b40c2f6
3.检查docker状态
[root@docker ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-10-25 11:40:20 CST; 8min ago
Docs: https://docs.docker.com
Main PID: 9403 (dockerd)
Tasks: 23
Memory: 111.8M
CGroup: /system.slice/docker.service
三、安装docker-compose
1.下载docker-compose二进制包
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
[root@node docker-compose]# curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 423 100 423 0 0 362 0 0:00:01 0:00:01 --:--:-- 362
100 16.2M 100 16.2M 0 0 8568k 0 0:00:01 0:00:01 --:--:-- 8568k
2.给文件增加执行权限
chmod +x /usr/local/bin/docker-compose
3.检查docker-compose版本
[root@node docker-compose]# docker-compose version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
四、下载Dochub镜像
[root@docker dochub]# docker pull truthhun/dochub:v2.3
v2.3: Pulling from truthhun/dochub
34667c7e4631: Pull complete
d18d76a881a4: Pull complete
119c7358fbfc: Pull complete
2aaf13f3eff0: Pull complete
d4455ddf7409: Pull complete
a472438775b3: Pull complete
e5f62349ad38: Pull complete
f46cb7840409: Pull complete
fab192f26205: Pull complete
Digest: sha256:dfb225b268ad46cfa2fcdd2fd538192614f0faf3da412d2a22d34efa17362b94
Status: Downloaded newer image for truthhun/dochub:v2.3
docker.io/truthhun/dochub:v2.3
五、安装Dochub
1.编辑docker-compose.yaml
[root@docker dochub]# cat docker-compose.yaml
version: '3'
services:
db:
image: mariadb:10.7
container_name: dochub_db
volumes:
- /data/dochub/db:/var/lib/mysql:rw
restart: always
networks:
- dochub
environment:
MYSQL_ROOT_PASSWORD: dochub
MYSQL_DATABASE: dochub
MYSQL_USER: dochub
MYSQL_PASSWORD: dochub
dochub:
depends_on:
- db
image: truthhun/dochub:v2.3
container_name: dochub
restart: always
networks:
- dochub
# environment:
# volumes:
# - /data/dochub/data:/www/dochub
ports:
- 8090:8090
networks:
dochub:
2.创建Dochub容器
[root@docker dochub]# docker-compose up -d
Creating network "dochub_dochub" with the default driver
Pulling db (mariadb:10.7)...
10.7: Pulling from library/mariadb
7b1a6ab2e44d: Already exists
034655750c88: Pull complete
f0b757a2a0f0: Pull complete
4bbcce26bc5e: Pull complete
04f220ee9266: Pull complete
89c8a77f7842: Pull complete
d1de5652303b: Pull complete
e10058b6c45e: Pull complete
a07ac6f8b619: Pull complete
6260e28f2886: Pull complete
Digest: sha256:832c6e488f49720f484f87ee9f2cd4487321b373db07ac77037860bcd97d92bb
Status: Downloaded newer image for mariadb:10.7
Creating dochub_db ... done
Creating dochub ... done
3.检查Dochub容器状态
[root@docker dochub]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3e3b26f20611 truthhun/dochub:v2.3 "./DocHub" About a minute ago Up About a minute 0.0.0.0:8090->8090/tcp, :::8090->8090/tcp dochub
12cc3dae3933 mariadb:10.7 "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp dochub_db
六、连接数据库
七、进入Dochub首页
八、登录Dochub后台管理
admin
admin
九、Dochub基本配置
1.依赖设置
系统设置——依赖设置
2.云存储配置
3.邮箱配置