Docker部署webdav服务hacdias新版

编程教程 > Docker Case (82) 2025-05-21 16:37:11

WebDAV新库

使用 hacdias/webdav库的镜像

镜像拉取参考:

docker pull ghcr.io/hacdias/webdav:v5.8

#或

docker pull hacdias/webdav:v5.8

Docker配置

webdav配置

config.yml 

users:
  - username: admin
    password: admin #配置的铭文密码
    permissions: CRUD
    directory: /data
directory: /data

其他基本不用改,完整配置参考:webdav/README.md at main · hacdias/webdav · GitHub

docker-compose.yml配置

version: '3'
services:
  webdav:
    image: lghcr.io/hacdias/webdav:v5.8
    restart: always
    ports:
      - "188:6065" #端口映射,默认端口是6065,也可通过config.yml修改默认端口注意哈。
    volumes:
      - ./config.yml:/config.yml:ro #加载webdav配置文件
      - /opt/gitea/data:/data/gitea

启动

docker-compose up -d

 

附:config.yml完整示例[官方复制]

address: 0.0.0.0
port: 6065

# TLS-related settings if you want to enable TLS directly.
tls: false
cert: cert.pem
key: key.pem

# Prefix to apply to the WebDAV path-ing. Default is '/'.
prefix: /

# Enable or disable debug logging. Default is 'false'.
debug: false

# Disable sniffing the files to detect their content type. Default is 'false'.
noSniff: false

# Whether the server runs behind a trusted proxy or not. When this is true,
# the header X-Forwarded-For will be used for logging the remote addresses
# of logging attempts (if available).
behindProxy: false

# The directory that will be able to be accessed by the users when connecting.
# This directory will be used by users unless they have their own 'directory' defined.
# Default is '.' (current directory).
directory: .

# The default permissions for users. This is a case insensitive option. Possible
# permissions: C (Create), R (Read), U (Update), D (Delete). You can combine multiple
# permissions. For example, to allow to read and create, set "RC". Default is "R".
permissions: R

# The default permissions rules for users. Default is none. Rules are applied
# from last to first, that is, the first rule that matches the request, starting
# from the end, will be applied to the request. Rule paths are always relative to
# the user's directory.
rules: []

# The behavior of redefining the rules for users. It can be:
# - overwrite: when a user has rules defined, these will overwrite any global
#   rules already defined. That is, the global rules are not applicable to the
#   user.
# - append: when a user has rules defined, these will be appended to the global
#   rules already defined. That is, for this user, their own specific rules will
#   be checked first, and then the global rules.
# Default is 'overwrite'.
rulesBehavior: overwrite

# Logging configuration
log:
  # Logging format ('console', 'json'). Default is 'console'.
  format: console
  # Enable or disable colors. Default is 'true'. Only applied if format is 'console'.
  colors: true
  # Logging outputs. You can have more than one output. Default is only 'stderr'.
  outputs:
  - stderr

# CORS configuration
cors:
  # Whether or not CORS configuration should be applied. Default is 'false'.
  enabled: true
  credentials: true
  allowed_headers:
    - Depth
  allowed_hosts:
    - http://localhost:8080
  allowed_methods:
    - GET
  exposed_headers:
    - Content-Length
    - Content-Range

# The list of users. If the list is empty, then there will be no authentication.
# Otherwise, basic authentication will automatically be configured.
#
# If you're delegating the authentication to a different service, you can proxy
# the username using basic authentication, and then disable webdav's password
# check using the option:
#
# noPassword: true
users:
  # Example 'admin' user with plaintext password.
  - username: admin
    password: admin
  # Example 'john' user with bcrypt encrypted password, with custom directory.
  # You can generate a bcrypt-encrypted password by using the 'webdav bcrypt'
  # command lint utility.
  - username: john
    password: "{bcrypt}$2y$10$zEP6oofmXFeHaeMfBNLnP.DO8m.H.Mwhd24/TOX2MWLxAExXi4qgi"
    directory: /another/path
  # Example user whose details will be picked up from the environment.
  - username: "{env}ENV_USERNAME"
    password: "{env}ENV_PASSWORD"
  - username: basic
    password: basic
    # Override default permissions.
    permissions: CRUD
    rules:
      # With this rule, the user CANNOT access {user directory}/some/files.
      - path: /some/file
        permissions: none
      # With this rule, the user CAN create, read, update and delete within
      # {user directory}/public/access.
      - path: /public/access/
        permissions: CRUD
      # With this rule, the user CAN read and update all files ending with .js.
      # It uses a regular expression.
      - regex: "^.+.js$"
        permissions: RU

 

 

 


评论
User Image
提示:请评论与当前内容相关的回复,广告、推广或无关内容将被删除。

相关文章
前置环境dockerdocker-composedocker安装参考:CentOS7安装最新Docker-ce-xqlee(blog.xqlee.com)Ubuntu在线安装Docker-xql...
一.群晖安装webdav套件​群晖安装WEBDAV套件二.群晖启用webdav套件​启用webdav套件这里的端口根据自己喜好设置,在局域网内访问的地址是:群晖IP:端口;外部网络访问则是:公网...
一. Docker-Compose 简介1. Docker-Compose 简介Docker-Compose项目是Docker官方的开源项目,负责实现对Docker容器集群的快速编排。Docke...
docker 常用命令整理(持续更新)docker运行容器资源相关查看所有运行docker的资源消耗情况docker stats查看指定运行容器资源消耗情况do
Docker从容器复制文件到主机sudo docker cp 容器名称/容器id:容器文件/目录 主机目录示例:sudo docker cp nginx:/et
在执行多次docker-compose build 之后,我们通过命令`docker images`可以看到很多的REPOSITORY 为<none&gtl; 且tag 也是<non...
旧域名:https://hub.docker.com 新域名:https://hubgw.docker.com/
Docker简介Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可
Ubuntu 系统安装DockerUbuntu 在线安装 Docker-XQLEE'Blog (在线安装,需外网好)Ubuntu 安装Docker 国内适用-X
Docker中容器/镜像的备份、恢复和迁移今天,我们将学习如何快速地对docker容器进行快捷备份、恢复和迁移。Docker是一个开源平台,用于自动化部署应用,
项目依赖说明Docker compose 示例docker-compose.yml 配置示例version: "3.8"networks: demoRouter
官方命令docker system prune -a特别注意:该命令会删除没有被使用的镜像 over
查看网络列表docker network ls删除某个网络docker network remove 网络名称查看网络详情docker network insp
背景Docker 对于新手开发者部署一些中间件或者开发环境比较友好,可惜官方image hub已被F...。内部使用必须依赖三方的镜像库,例如阿里云的https
安装篇国外:curl -fsSL https://get.docker.com | bash国内:curl -fsSL https://get.docker.com | bash -s dock...