云原生之使用Docker部署h5ai文件展示页
一、h5ai介绍
h5ai是一款适用于 Apache httpd、lighttpd 和 nginx 的现代 HTTP Web 服务器搜索引擎。
二、检查本地docker服务
1.检查系统docker状态
[root@server001 ~]# 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 Sat 2023-02-04 11:57:41 CST; 5 days ago
Docs: https://docs.docker.com
Main PID: 2469 (dockerd)
Tasks: 276
Memory: 140.9M
2.检查docker版本
[root@server001 ~]# docker version
Client: Docker Engine - Community
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:04:24 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 18:02:38 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.10
GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
三、下载h5ai镜像
[root@server001 ~]# docker pull ilemonrain/h5ai:full
full: Pulling from ilemonrain/h5ai
ff3a5c916c92: Pull complete
7a9c7a1e0824: Pull complete
6d145ebf3d38: Pull complete
5fbde24e0ec4: Pull complete
2652b741e876: Pull complete
9f22ff66ccbe: Pull complete
aee5bb436b1a: Pull complete
22b86147ebbe: Pull complete
c10620da8910: Pull complete
Digest: sha256:f6633f5d3f8001253cd4e23d9c0303270b04307ed19a9850c2a37307453700fc
Status: Downloaded newer image for ilemonrain/h5ai:full
docker.io/ilemonrain/h5ai:full
四、部署h5ai服务
1.创建数据挂载目录
[root@server001 ~]# mkdir -p /data/h5ai/
[root@server001 ~]# cd /data/h5ai/
[root@server001 h5ai]#
2.创建h5ai容器
[root@server001 h5ai]# docker run -d --name h5ai --restart always -p 5555:80 -v /data/h5ai/:/h5ai ilemonrain/h5ai:full
0a30f9c72a831f9a04dc8235ff965deb05726fdd907060f80cdda9337f479358
3.检查h5ai容器状态
[root@server001 h5ai]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a30f9c72a83 ilemonrain/h5ai:full "sh /scripts/entrypo…" 23 seconds ago Up 22 seconds 0.0.0.0:5555->80/tcp, :::5555->80/tcp h5ai
4.查看h5ai容器运行状态
[root@server001 h5ai]# docker logs h5ai
Starting Docker-Linux ...
[2023/02/09 07:20:47] Deploying h5ai ...
[2023/02/09 07:20:47] Unpacking h5ai ...
[2023/02/09 07:20:47] Changing owner for /h5ai/ ...
[2023/02/09 07:20:47] Changing privilege for /h5ai/_h5ai/private/cache/ ...
[2023/02/09 07:20:47] Changing privilege for /h5ai/_h5ai/public/cache/ ...
[2023/02/09 07:20:47] Applying Apache 2 Settings ...
[2023/02/09 07:20:47] Cleaning up ...
[2023/02/09 07:20:47] Finishing Deployment ...
--- Information of the running enviroment ---
Linux Version : Alpine Linux 3.7.0
Linux Kernel Version : 3.10.0-957.el7.x86_64
Linux Architecture : x86_64
Docker Hostname : 0a30f9c72a83
Server IP : xx.xx.xx.xx
***********************************************
[2023/02/09 07:20:48] Starting Apache ...
[2023/02/09 07:20:48] Start Success ! Enjoy your Docker-h5ai !
***********************************************
五、访问h5ai服务
http://192.168.3.158:5555/
六、h5ai的基本使用
1.在挂载目录创建子目录及文件
在挂载目录创建子目录及文件
[root@server001 h5ai]# mkdir test
[root@server001 h5ai]# ls
_h5ai robots.txt test
[root@server001 h5ai]# cd test/
[root@server001 test]# ls
[root@server001 test]# touch file{1..5}
[root@server001 test]# ls
file1 file2 file3 file4 file5
[root@server001 test]#
2.查看h5ai首页
3.查看文件内容
选择目录下的文件,点击即可浏览文件内容。