云原生之使用Docker部署File Manager文件管理系统
【摘要】 云原生之使用Docker部署File Manager文件管理系统
一、File Manager简介
1.File Manager简介
Filemanager 是一款轻量级开源文件管理系统。可用于上传,删除,预览,重命名和编辑文件。它允许创建多个用户,每个用户可以拥有自己的目录。
2.File Manager特点
- 服务器信息查看
- 目录树查看
- 可对文件和目录进行复制/移动/删除/创建/重命名/编辑/查看/更改权限等操作
- tar/zip/bzip/gzip 在线压缩/解压
- 多文件上传
- shell/exec 控制台操作
- 支持 linux/windows 操作系统
- php4/php5/apache2 兼容
- English/Portuguese/简体中文支持
二、检查宿主机系统版本
[root@docker ~]# 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@docker ~]# 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 Fri 2022-10-21 13:52:55 CST; 39min ago
Docs: https://docs.docker.com
Main PID: 9813 (dockerd)
Tasks: 22
Memory: 110.5M
CGroup: /system.slice/docker.service
├─ 9813 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─13425 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.20.0.2 -container-port 3...
└─13453 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3000 -container-ip 172.20.0.2 -container-port 3000
Oct 21 13:52:39 docker dockerd[9813]: time="2022-10-21T13:52:39.865036098+08:00" level=info msg="ccResolverWrapper: send...le=grpc
Oct 21 13:52:39 docker dockerd[9813]: time="2022-10-21T13:52:39.865044855+08:00" level=info msg="ClientConn switching ba...le=grpc
Oct 21 13:52:41 docker dockerd[9813]: time="2022-10-21T13:52:41.471511161+08:00" level=info msg="[graphdriver] using pri...erlay2"
Oct 21 13:52:45 docker dockerd[9813]: time="2022-10-21T13:52:45.234684184+08:00" level=info msg="Loading containers: start."
Oct 21 13:52:47 docker dockerd[9813]: time="2022-10-21T13:52:47.414394139+08:00" level=info msg="Default bridge (docker0...ddress"
Oct 21 13:52:54 docker dockerd[9813]: time="2022-10-21T13:52:54.698122310+08:00" level=info msg="Loading containers: done."
Oct 21 13:52:54 docker dockerd[9813]: time="2022-10-21T13:52:54.973240663+08:00" level=info msg="Docker daemon" commit=e...0.10.18
Oct 21 13:52:54 docker dockerd[9813]: time="2022-10-21T13:52:54.973328839+08:00" level=info msg="Daemon has completed in...zation"
Oct 21 13:52:55 docker systemd[1]: Started Docker Application Container Engine.
Oct 21 13:52:55 docker dockerd[9813]: time="2022-10-21T13:52:55.682450266+08:00" level=info msg="API listen on /var/run/...r.sock"
Hint: Some lines were ellipsized, use -l to show in full.
2.检查docker配置信息
[root@docker ~]# 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@docker ~]# echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
[root@docker ~]# systemctl restart network
[root@docker ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
4.检查Docker版本
[root@docker ~]# 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@docker ~]# 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@docker ~]# 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
五、下载File Manager镜像
[root@docker ~]# docker pull smokserwis/filemanager
Using default tag: latest
latest: Pulling from smokserwis/filemanager
f49cf87b52c1: Pull complete
185616061386: Pull complete
5fc132db2e0d: Pull complete
00c1c323341a: Pull complete
ff3701349211: Pull complete
faab1d6ad70f: Pull complete
eae8d88d75e0: Pull complete
7fbd4c732645: Pull complete
b2e59bdd1208: Pull complete
dc295cd4163b: Pull complete
f20cf94ab013: Pull complete
2487c77e7431: Pull complete
cb2ac2ff3a32: Pull complete
91b8af3e62cb: Pull complete
bed3abc70e62: Pull complete
15834f4d9c5d: Pull complete
4f1122fc66de: Pull complete
60b7b339ab82: Pull complete
9166eab89063: Pull complete
42913d62f903: Pull complete
Digest: sha256:43b8f2c5bfad99b5c3790f13e61f8dc2e612b2bec24a2d875e6742bd6046bb74
Status: Downloaded newer image for smokserwis/filemanager:latest
docker.io/smokserwis/filemanager:latest
六、docker-cli部署File Manager
docker run -h example.com -v /your/files:/var/www/mount -p 80:80 smokserwis/filemanager
七、使用docker-compose部署File Manager
1.编辑docker-compose.yaml
[root@docker filemanager]# cat docker-compose.yaml
version: '3.5'
services:
filemanager:
image: smokserwis/filemanager
restart: always
container_name: filemanager
volumes:
- /data/filemanager/files:/var/www/mount
ports:
- 8011:80
networks:
- files
networks:
files:
2.创建File Manager容器
[root@docker filemanager]# docker-compose up -d
Creating network "filemanager_files" with the default driver
Creating filemanager ... done
3.查看容器状态
[root@docker filemanager]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b82aa51eeb11 smokserwis/filemanager "docker-php-entrypoi…" About a minute ago Up About a minute 0.0.0.0:8011->80/tcp, :::8011->80/tcp filemanager
八、登录File Manager
1.进入File Manager首页
fm_admin / fm_admin
2.进入File Manager首页
九、上传文件
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)