聊聊其他之ShowDoc安装部署

聊聊其他之ShowDoc安装部署

Docker离线安装部署

由于很多公司服务器处于内网环境,跟外网阻断,所以需要通过离线的方式进行Docker镜像安装。

Linux环境准备

第一步:检查防火墙,是否关闭。

xml 复制代码
查看防火墙状态:
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

防火墙关闭
[root@localhost ~]# systemctl stop firewalld

第二步:关闭Selinux策略

xml 复制代码
将配置文件中的SELINUX改成disabled后保存退出
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled

第三步:检查文件/etc/timezone

检查是否存在/etc/timezone 文件,如果没有,后面执行docker run 命令的时候,需要删除命令中关>于/etc/timezone 的映射以免报错,只是用/etc/localtime做时间同步

前期准备工作完成

Docker部署

第一步:下载安装包。

下载安装包路径:https://download.docker.com/linux/static/stable/x86_64/

第二步:上传至服务器

xml 复制代码
[root@localhost docker]# pwd
/ftp/Stability/docker

[root@localhost docker]# ll
total 61772
-rw-r--r-- 1 root root 63252595 Jan  7 09:55 docker-19.03.5.tgz

第三步:解压程序包

xml 复制代码
[root@localhost docker]# tar -zxvf docker-19.03.5.tgz
docker/
docker/docker-init
docker/docker
docker/dockerd
docker/runc
docker/ctr
docker/docker-proxy
docker/containerd
docker/containerd-shim

第四步:拷贝程序

.root@localhost docker# sudo cp docker/* /usr/bin/

第五步:程序运行,后台启动

root@localhost docker# sudo dockerd &

第六步:设置docker开机启动,务必关闭selinux,并且重启了系统。

xml 复制代码
总共包含两个文件:
docker.service和docker.sockert
其中docker.service内容如下
[root@localhost docker]# cat docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

其中docker.socket内容如下
[root@localhost docker]# cat docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
# If /var/run is not implemented as a symlink to /run, you may need to
# specify ListenStream=/var/run/docker.sock instead.
ListenStream=/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target

第七步:执行命令,设置docker开机自启动;在docker.service和docker.socket所在文件夹行进行执行。

xml 复制代码
[root@localhost docker]# sudo cp docker.socket /etc/systemd/system
[root@localhost docker]# sudo cp docker.service /etc/systemd/system
[root@localhost docker]# sudo systemctl daemon-reload
[root@localhost docker]# sudo systemctl start docker
[root@localhost docker]# sudo systemctl enable docker
设置完以后使用reboot重启服务器,docker会开机自启动
检查docker服务是否启动
[root@localhost docker]# sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-01-07 10:11:54 CST; 45s ago

至此docker服务已经安装完成

ShowDoc安装

第一步:下载ShowDoc镜像文件

由于很多公司网络限制,需要本地进行安装

第二步:加载镜像

xml 复制代码
[root@localhost showdoc]# docker load --i images.tar

第三步:工作准备

xml 复制代码
[root@localhost showdoc]# sudo mkdir /data
[root@localhost showdoc]# sudo mkdir /data/showdoc_data
[root@localhost showdoc]# sudo mkdir /data/showdoc_data/html
[root@localhost showdoc]# sudo chmod --R 777 /data/showdoc_data

第四步:运行镜像

xml 复制代码
[root@localhost showdoc]# docker run --d --name showdoc --p 4999:80 --v /data/showdoc_data/html:var/www/html/star7th/showdoc

第五步:平台访问,地址:http://XX.XX.XX.XX:4999/

相关推荐
宋均浩7 小时前
# Docker 镜像瘦身实战:从 1.2G 到 80MB 的五个优化步骤
ci/cd·docker
程序员老赵1 天前
10 分钟部署 OpenCode:Docker 一键安装,浏览器打开就能用 AI 写代码(附完整命令与排错)
docker·容器·ai编程
WangMingHua1111 天前
LM Studio Docker 部署——本地大模型一键启动
docker
曲幽2 天前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
武子康4 天前
调查研究-183 Apple container:Mac 上用轻量 VM 跑 Linux 容器,Swift 会改写本地容器体验吗?
docker·容器·apple
Alsn867 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
程序员老赵7 天前
服务器没有桌面?Docker 跑个 Chrome,浏览器就能远程用
docker·容器·devops
杨浦老苏7 天前
轻量级Docker仪表板Servedash
运维·docker·监控·群晖·仪表板
正经教主7 天前
【docker基础】 第八周:容器监控与应用更新策略
运维·docker·容器
kiros_wang7 天前
Docker 使用完整指南
运维·docker·容器