[star7th/showdoc]Docker 部署 showdoc 失败

2024-08-05 186 views
8

使用如下命令下载并部署运行部署脚本

wget https://www.showdoc.cc/script/showdoc;chmod +x showdoc;
./showdoc

命令输出结果

[root@lmj-centos showdoc]# ./showdoc 
Redirecting to /bin/systemctl start docker.service
The showdoc image is being retrieved, please wait a moment... The time required is related to your network environment.
正在拉取showdoc镜像,请稍后...所需时间与你的网络环境有关
Using default tag: latest
latest: Pulling from star7th/showdoc
ca7dd9ec2225: Pull complete 
1b78b4fe0ca1: Pull complete 
9d6040f2a28f: Pull complete 
0e2e66b89284: Pull complete 
3b1be5f02bec: Pull complete 
96243f515dda: Pull complete 
e427679e7c26: Pull complete 
759eb390abda: Pull complete 
9820b782a628: Pull complete 
a9e6097c1efa: Pull complete 
a62398aac06f: Pull complete 
99fe33104b99: Pull complete 
504c69a3f2b1: Pull complete 
f43491cb0d98: Pull complete 
2f3c78d8a096: Pull complete 
4311bc3c36bd: Pull complete 
e5d5a5e31b79: Pull complete 
76e9f3c35772: Pull complete 
ecdae090849c: Pull complete 
25e43d0a3559: Pull complete 
83a03a44a074: Pull complete 
aa34535dc206: Pull complete 
e92cfcb70c40: Pull complete 
813e42a234aa: Pull complete 
824411b05489: Pull complete 
0dc0b44a9c4d: Pull complete 
bc37587fccce: Pull complete 
048f4feb3a7a: Pull complete 
1dbee6753144: Pull complete 
6ad6f9a31b68: Pull complete 
0a193dfa0f9a: Pull complete 
Digest: sha256:bf8ba0a2da7d9927e6982c1e28a9412bbbc7ebbf0361504b147851c94d40d697
Status: Downloaded newer image for registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest
registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest
4fac70d5a26c339067307dea046f90c01720f111739426f1ff770fe9720f2efd
curl: (56) Recv failure: Connection reset by peer
--2023-07-14 09:22:38--  http://localhost:4999/install/install.lock
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:4999... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2023-07-14 09:22:39--  (try: 2)  http://localhost:4999/install/install.lock
Connecting to localhost (localhost)|::1|:4999... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2023-07-14 09:22:41--  (try: 3)  http://localhost:4999/install/install.lock
Connecting to localhost (localhost)|::1|:4999... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2023-07-14 09:22:44--  (try: 4)  http://localhost:4999/install/install.lock
Connecting to localhost (localhost)|::1|:4999... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2023-07-14 09:22:48--  (try: 5)  http://localhost:4999/install/install.lock
Connecting to localhost (localhost)|::1|:4999... connected.
HTTP request sent, awaiting response... 

等待了很久,并没有看到成功部署的消息,于是我查看了容器的日志,docker logs 4fac70d5a26c 在日志中,输出了很多这种报错信息。

[14-Jul-2023 01:33:45] WARNING: [pool www] child 12513 exited with code 70 after 0.021528 seconds from start
[14-Jul-2023 01:33:45] NOTICE: [pool www] child 12522 started
[14-Jul-2023 01:33:45] WARNING: [pool www] child 12518 exited with code 70 after 0.009431 seconds from start
[14-Jul-2023 01:33:45] NOTICE: [pool www] child 12523 started
[14-Jul-2023 01:33:45] WARNING: [pool www] child 12520 exited with code 70 after 0.006807 seconds from start
[14-Jul-2023 01:33:45] NOTICE: [pool www] child 12524 started
[14-Jul-2023 01:33:45] WARNING: [pool www] child 12521 exited with code 70 after 0.006823 seconds from start
[14-Jul-2023 01:33:45] NOTICE: [pool www] child 12525 started
[14-Jul-2023 01:33:45] WARNING: [pool www] child 12519 exited with code 70 after 0.011361 seconds from start
[14-Jul-2023 01:33:45] NOTICE: [pool www] child 12526 started
ERROR: [pool www] failed to initgroups(application, 1000): Bad address (14)
ERROR: [pool www] child failed to initialize
ERROR: [pool www] failed to initgroups(application, 1000): Bad address (14)
ERROR: [pool www] child failed to initialize
ERROR: [pool www] failed to initgroups(application, 1000): Bad address (14)
ERROR: [pool www] child failed to initialize

回答

2

你的容器服务有问题。可能是服务器安全限制。不清楚什么限制。 你可以试着尝试安装任何容器,应该都不能转发端口,都会转发端口失败的。

6

这台机器也安装过其它的容器,转发端口并没有问题

8

分享一个docker-compose文件:

version: '3'

networks:
  web-network:

services:
  showdoc:
    image: star7th/showdoc:v3.2.2
    hostname: showdoc
    ports:
      - 4999:80
    volumes:
      - ./data/html:/var/www/html
    restart: always
    tty: true
    networks:
      - web-network

将以上内容保存为docker-compose.yml,然后执行docker-compose up -d即可启动服务,稍等片刻就能使用http://localhost:4999访问了。

4

参考帮助文档:https://www.showdoc.com.cn/help?page_id=65610


# 中国大陆镜像安装命令(安装后记得执行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

运行后结果如下: image

1

命令 chmod -R 777 /showdoc_data 就是赋予权限的意思。如果说有了权限但是还不能,那就是有安全机制限制了你写文件。我不知道你的服务器会有什么限制docker写文件