Docker way to install showdoc & Docker way to upgrade showdoc

Get new skills, record it.

Original link: https://www.showdoc.com.cn/help?page_id=65610

Basic installation
Before installation, please make sure that the docker service has been installed in your environment. There are many docker installation tutorials on the Internet, you can search for it. Here we focus on showdoc.

# 原版官方镜像安装命令(中国大陆用户不建议直接使用原版镜像,可以用后面的加速镜像)
# 如果你打算安装ARM版本的docker镜像,请将 latest 标签改为 arm-latest
docker pull star7th/showdoc:latest 

# 中国大陆镜像安装命令(安装后记得执行docker tag命令以进行重命名)
docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest 

##后续命令无论使用官方镜像还是加速镜像都需要执行

#新建存放showdoc数据的目录
mkdir -p /showdoc_data/html
chmod  -R 777 /showdoc_data
# 如果你是想把数据挂载到其他目录,比如说/data1,那么,可以在/data1目录下新建一个showdoc_data/目录,
# 然后在根目录的新建一个软链接/showdoc_data到/data1/showdoc_data
# 这样既能保持跟官方教程推荐的路径一致,又能达到自定义存储的目的.

#启动showdoc容器
docker run -d --name showdoc --user=root --privileged=true -p 4999:80 \
-v /showdoc_data/html:/var/www/html/ star7th/showdoc

If you operate according to the above command, the data of showdoc will be stored in the /showdoc_data/html directory in the future.
You can open http://localhost:4999 to visit showdoc (localhost can be changed to your server domain name or IP). The account password is showdoc/123456. After logging in, you can see the management background entrance on the upper right. It is recommended to change the password after logging in.
For questions or suggestions about showdoc, please submit an issue on github. If you think showdoc is easy to use, you might as well click a star.

how to upgrade

# 从原版官方库更新镜像。(中国大陆用户不建议直接使用原版镜像,可以用后面的加速镜像)
docker pull star7th/showdoc 

# 中国大陆镜像更新命令(更新后记得执行docker tag命令以进行重命名)
docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest  

##后续命令无论使用官方镜像还是加速镜像都需要执行


rm -rf  /showdoc_data/html_bak
#备份。如果可以的话,命令中的html_bak还可以加上日期后缀,以便保留不同日期的多个备份
mv /showdoc_data/html  /showdoc_data/html_bak

# 新建准备存放新版代码的目录
mkdir -p /showdoc_data/html
chmod  -R 777 /showdoc_data/html

# 删除旧容器
docker stop showdoc && docker rm showdoc 

#启动showdoc容器
docker run -d --name showdoc --user=root --privileged=true -p 4999:80 \
-v /showdoc_data/html:/var/www/html/ star7th/showdoc

#执行新代码安装。默认安装中文版。如果想安装英文版,将下面参数中的zh改为en
curl http://localhost:4999/install/non_interactive.php?lang=zh

#转移旧数据库
\cp  -f  /showdoc_data/html_bak/Sqlite/showdoc.db.php /showdoc_data/html/Sqlite/showdoc.db.php

#转移旧附件数据
\cp -r -f /showdoc_data/html_bak/Public/Uploads/. /showdoc_data/html/Public/Uploads

# 重新给权限
chmod  -R 777 /showdoc_data/html

#如果中途出错,请重命名原来的/showdoc_data/html_bak文件为/showdoc_data/html ,然后重启容器便可恢复。

Guess you like

Origin blog.csdn.net/qq_44821149/article/details/131646119
Recommended