Docker部署Alist网盘直链程序
一、Alist介绍
1.Alist简介
AList是一款个支持多种存储的目录文件列表程序,后端基于golang最好的http框架gin,前端使用vue和ant design。
2.Alist支持的网盘
1.本地存储
2. Aliyundrive
3.OneDrive / Sharepoint (全球,cn、德、美国)
4.189云(个人、家庭)
5.GoogleDrive
6.123pan
7.蓝奏云Alist
8.Alist
9.FTP
10.PikPak
11.ShandianPan
12.S3
13.WebDav(支持OneDrive / SharePoint没有API)
14.Teambition (中国,国际)
15.Mediatrack
16.139云(个人、家庭)
17.Yandex.Disk
18.百度网盘
19.夸克
20.XunleiCloud
21.SFTP
3.Alist特点
1.文件预览(PDF、markdown、代码、纯文本……)
2.图库模式下的图像预览
3.视频和音频预览(mp4、mp3、…)
4.Office 文档预览(docx、pptx、xlsx、…)
5.README.md预览渲染
6.文件永久链接复制和直接文件下载
7.黑暗模式
8.I18n
9.受保护的路由(密码保护和身份验证)
10.WebDav(有关详细信息,请参阅https://alist-doc.nn.ci/en/docs/webdav)
11.Docker部署
12.Cloudflare 工作人员代理
13.文件/文件夹包下载
14.支持视频列表播放和字幕(ass,srt,vtt)
15.网页上传(可以允许访问者上传)、删除、mkdir、重命名和移动
二、检查宿主机系统版本
[root@node ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
三、检查本地docker环境
1.检查docker服务状态
[root@node ~]# 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 Sun 2022-09-25 03:04:11 CST; 7h ago
Docs: https://docs.docker.com
Main PID: 10004 (dockerd)
Tasks: 75
Memory: 206.3M
CGroup: /system.slice/docker.service
├─10004 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─13175 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6806 -container-ip 172.17.0.2 -container-port 6806
├─13185 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6806 -container-ip 172.17.0.2 -container-port 6806
├─13256 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 90 -container-ip 172.17.0.3 -container-port 80
├─13263 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 90 -container-ip 172.17.0.3 -container-port 80
├─27866 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 4541 -container-ip 172.17.0.4 -container-port 4041
├─27872 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 4541 -container-ip 172.17.0.4 -container-port 4041
├─27886 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 4540 -container-ip 172.17.0.4 -container-port 4040
├─27892 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 4540 -container-ip 172.17.0.4 -container-port 4040
├─27905 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 1981 -container-ip 172.17.0.4 -container-port 1900
└─27911 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 1981 -container-ip 172.17.0.4 -container-port 1900
Sep 25 03:25:20 node dockerd[10004]: time="2022-09-25T03:25:20.736168620+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:21 node dockerd[10004]: time="2022-09-25T03:25:21.347611121+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:22 node dockerd[10004]: time="2022-09-25T03:25:22.115781758+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:23 node dockerd[10004]: time="2022-09-25T03:25:23.331912164+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:25 node dockerd[10004]: time="2022-09-25T03:25:25.375883250+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:28 node dockerd[10004]: time="2022-09-25T03:25:28.964063943+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:35 node dockerd[10004]: time="2022-09-25T03:25:35.809271761+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:25:49 node dockerd[10004]: time="2022-09-25T03:25:49.027729346+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:26:15 node dockerd[10004]: time="2022-09-25T03:26:15.070714080+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Sep 25 03:27:06 node dockerd[10004]: time="2022-09-25T03:27:06.744950332+08:00" level=info msg="ignoring event" container=26d9ded7d419b7e1d9a6946...askDelete"
Hint: Some lines were ellipsized, use -l to show in full.
2.检查docker配置信息
[root@node ~]# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
compose: Docker Compose (Docker Inc., v2.6.0)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 3
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc version: v1.1.2-0-ga916309
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.62GiB
Name: node
ID: EIOB:6IAO:NQTR:AJBA:O6KS:SNWP:JEDK:GXBG:55FP:IOSK:WRH3:QOAU
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://sp4mg57h.mirror.aliyuncs.com/
Live Restore Enabled: false
WARNING: IPv4 forwarding is disabled
3.开启IPv4 forwarding
[root@node ~]# echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
[root@node ~]# systemctl restart network
[root@node ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
4.检查Docker版本
[root@node ~]# docker -v
Docker version 20.10.17, build 100c701
四、安装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
五、下载Alist镜像
[root@node ~]# docker pull xhofe/alist
Using default tag: latest
latest: Pulling from xhofe/alist
41dcc117e123: Pull complete
69bb390438f6: Pull complete
62d70e6ba666: Pull complete
latest: Pulling from xhofe/alist
88ecf269dec3: Pull complete
1cb53cd8574e: Pull complete
c038bfab71d4: Pull complete
838111a93e62: Pull complete
Digest: sha256:d4966c9a0cdb185251943afaa6320ae0e26a0fcd9e91dc24c2a9117eda83a18f
Status: Downloaded newer image for xhofe/alist:latest
docker.io/xhofe/alist:latest
六、使用docker命令部署Alist
docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:latest
七、使用Docker-compose部署Alist
1.编写docker-compose.yaml
[root@node alist]# cat docker-compose.yaml
version: "3.7"
services:
alist:
image: xhofe/alist:latest
container_name: alist
ports:
- 5109:5244
volumes:
- /data/alist/data:/opt/alist/data
restart: always
2.创建alist容器
[root@node alist]# docker-compose up -d
Creating network "alist_default" with the default driver
Creating alist ... done
3.查看容器状态
[root@node alist]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
920f110c4585 xhofe/alist:latest "./alist server --no…" 3 seconds ago Up 2 seconds 0.0.0.0:5109->5244/tcp, :::5109->5244/tcp
八、访问Alist首页
1.查看容器日志登录密码
[root@node alist]# docker logs alist
INFO[2022-09-25 02:59:15] reading config file: data/config.json
INFO[2022-09-25 02:59:15] config file not exists, creating default config file
INFO[2022-09-25 02:59:15] load config from env with prefix:
INFO[2022-09-25 02:59:15] init logrus...
INFO[2022-09-25 02:59:15] Successfully created the admin user and the initial password is: lZ7rNIbo
INFO[2022-09-25 02:59:15] start server @ 0.0.0.0:5244