https://pixabay.com/de/photos/archiv-hintergrund-nahaufname-2752940/

Building Your Own Secure WebDAV Server with Docker

Introducing WebDAV

WebDAV, or Web Distributed Authoring and Versioning, is an extension of the Hypertext Transfer Protocol (HTTP) that allows users to collaboratively edit and manage files on remote web servers. Think of it as a file server accessible over the web, enabling you to create, change, and move documents directly on the server, much like a network drive. It’s widely used for synchronizing files across devices and providing remote access to document repositories.

Introducing sfuhrm/docker-nginx-webdav

The sfuhrm/docker-nginx-webdav Docker image provides an incredibly secure, fast, and lightweight WebDAV server built on a minimal Alpine Linux base. This image is designed for efficiency and security, making it an excellent choice for deploying your personal or small-scale WebDAV service.

What sets this image apart?

  • Tiny Footprint: At approximately 5.3 MB, with containers typically using around 10 MB of memory, it’s remarkably small and resource-efficient.
  • Enhanced Security: It prioritizes security by never storing filesystem secrets directly in environment variables. Instead, it leverages Docker secrets for managing sensitive credentials.
  • Robust Foundation: Built on Alpine Linux, known for its small size and security focus.
  • Automated Builds: Integrates with GitHub Actions for automated daily builds, ensuring you always have access to the latest, well-maintained image.

Getting Started: Usage

Setting up your WebDAV server with sfuhrm/docker-nginx-webdav is straightforward. You can run it directly with Docker, mapping a port and specifying a volume for your files:

Bash

docker run --name my-webdav-server \
  -p 80:80 \
  -v /path/to/your/files/:/media/data \
  -d sfuhrm/docker-nginx-webdav

Replace /path/to/your/files/ with the actual path on your host system where you want your WebDAV files to be stored.

Authentication

For secure access, you’ll want to set up authentication. The image supports both environment variables and, more securely, Docker secrets:

  • Environment Variables (for quick testing, less secure):Bashdocker run --name my-webdav-server \ -p 80:80 \ -e USERNAME=your_username \ -e PASSWORD=your_password \ -v /path/to/your/files/:/media/data \ -d sfuhrm/docker-nginx-webdav
  • Docker Secrets (recommended for production):Create secret files (e.g., username.txt and password.txt) and mount them:Bashdocker run --name my-webdav-server \ -p 80:80 \ -e USERNAME_FILE=/run/secrets/username.txt \ -e PASSWORD_FILE=/run/secrets/password.txt \ --secret source=username.txt,target=username.txt \ --secret source=password.txt,target=password.txt \ -v /path/to/your/files/:/media/data \ -d sfuhrm/docker-nginx-webdav (Note: This example assumes username.txt and password.txt are Docker secrets available to the service.)

For a more comprehensive setup, especially with secrets, consider using the provided docker-compose.yml example in the GitHub repository. It’s also strongly recommended to place this WebDAV server behind a reverse proxy with TLS (e.g., Nginx, Caddy) to encrypt your traffic, as the image itself does not include built-in TLS support.


Contribute to the Project!

The sfuhrm/docker-nginx-webdav project is open-source and thrives on community contributions. If you find this image useful, have ideas for improvements, or encounter any issues, your participation is highly encouraged! Whether it’s reporting bugs, suggesting new features, or contributing code, every bit helps make this a better tool for everyone.

Get involved on GitHub:

Your contributions can help shape the future of this lightweight and secure WebDAV solution!