Linux Docker挂载群晖WebDAV到本地

挂载群晖的WebDAV,使用群晖的WebDAV Server搭建的服务。

群晖配置了证书。

使用镜像:docker-webdav-client

docker run -it --rm \
    --device /dev/fuse \
    --cap-add SYS_ADMIN \
    --security-opt "apparmor=unconfined" \
    --env "WEBDRIVE_USERNAME=<YourUserName>" \
    --env "WEBDRIVE_PASSWORD=<SuperSecretPassword>" \
    --env "WEBDRIVE_URL=https://dav.box.com/dav" \
    --env "DAVFS2_ASK_AUTH=0" \
    -v /mnt/tmp:/mnt/webdrive:rshared \
    efrecon/webdav-client

这个镜像就是封装了davfs2

用环境变量DAVFS2_开头可以将参数写入到此工具的配置文件:/etc/davfs2/davfs2.conf

DAVFS2_ASK_AUTH=0 :如果在secretsfile中找不到凭据和密码,则以交互方式询问用户。询问用户是否无法验证servercert。0 =否,1 =是。

在绑定过程中发生以下错误:

Caught TERM! Unmounting /mnt/webdrive...
Forwarding TERM to 13
the server certificate does not match the server name
the server certificate is not trusted
issuer:      Synology Inc., Taipel, TW
subject:     Synology Inc., Taipel, TW
identity:    synology
fingerprint: xxxx
You only should accept this certificate, if you can
verify the fingerprint! The server might be faked
or there might be a man-in-the-middle-attack.

这是因为用的IP和SSL证书不匹配,解决:

导出群晖的证书:控制面板-安全性-证书-操作-导出证书 解压 只需要cert.pem,放到Linux服务器上

增加以下参数:

--env "DAVFS2_trust_server_cert=/cert/cert.pem" 用于指定证书,路径是容器内的

-v /root/webdav/cert:/cert 将证书映射进容器

docker run -it --rm \
    --device /dev/fuse \
    --cap-add SYS_ADMIN \
    --security-opt "apparmor=unconfined" \
    --env "WEBDRIVE_USERNAME=<YourUserName>" \
    --env "WEBDRIVE_PASSWORD=<SuperSecretPassword>" \
    --env "WEBDRIVE_URL=https://dav.box.com/dav" \
    --env "DAVFS2_ASK_AUTH=0" \
    --env "DAVFS2_trust_server_cert=/cert/cert.pem" \
    -v /mnt/tmp:/mnt/webdrive:rshared \
    -v /root/webdav/cert:/cert \
    efrecon/webdav-client
相关推荐
DC_BLOG37 分钟前
IPv6(四)
运维·服务器·网络·ip
shelby_loo37 分钟前
通过 Docker 部署 MySQL 服务器
服务器·mysql·docker
沈艺强43 分钟前
伊犁linux 创建yum 源过程
linux·运维·服务器
拾光师1 小时前
linux命令行快捷键
linux·运维·服务器
Dola_Pan3 小时前
Linux文件IO(二)-文件操作使用详解
java·linux·服务器
wang_book3 小时前
Gitlab学习(007 gitlab项目操作)
java·运维·git·学习·spring·gitlab
prcyang4 小时前
Docker Compose
运维·docker·容器
蜗牛^^O^4 小时前
Docker和K8S
java·docker·kubernetes
脚踏实地的大梦想家4 小时前
【Docker】安装全流程与配置完整镜像源(可安装 nginx)
运维·docker·容器
城南云小白4 小时前
Linux网络服务只iptables防火墙工具
linux·服务器·网络