安装docker&docker-compose 跳过
不会的,查看之前的博客,很详细
编写docker-compose文件
version: '3.1'
services:
webdav:
image: zx5253/webdav-aliyundriver #webdav的镜像
restart: always
user: root
container_name: webdav
ports:
- "9876:8080"
volumes:
- /opt/aliyun-driver/:/etc/aliyun-driver
- /etc/localtime:/etc/localtime
environment:
- ALIYUNDRIVE_REFRESH_TOKEN=kjhkjhkjhkih1jhkijkhkuhkhjhdas # 阿里云的token
- ALIYUNDRIVE_AUTH_PASSWORD=admin # webdav 的账号
- ALIYUNDRIVE_AUTH_USER=admin # webdav 的密码
# - JAVA_OPTS='-Xms128m -Xmx1024m'
# - TZ='Asia/Shanghai'
查看docker日志docker logs webdav
没有报错,且请求正常 则为成功
浏览器访问服务器ip:9876 输入账号密码,应该就能看到云盘里的内容
至此,webdav搭建成功
接下来进行磁盘挂载
安装软件包apt-get install davfs2
创建挂载文件夹mkdir -p /mnt/cloud/
挂载mount -t davfs http://127.0.0.1:9876 /mnt/cloud/
输入用户名:
输入密码:
mount -t davfs http://127.0.0.1:9876 /mnt/cloud/
Please enter the username to authenticate with server
http://127.0.0.1:9876 or hit enter for none.
Username: admin
Please enter the password to authenticate user admin with server
http://127.0.0.1:9876 or hit enter for none.
Password:
查看磁盘df -h
开机自动挂载,嗯?再说吧,不写了,云服务器永不关机