Skip to content

WebDAV container setup

Introduction

A tiny container running WebDAV to create, change and move documents on a server. From a Synology NAS, I make backups to a Linux server where this WebDAV container is running and is set as the backup destination.

Setup

  1. Create the folders needed by the container

    Run the following commands inside your home folder:

    # Open your terminal application
    cd ~
    mkdir -p webdav/data
    mkdir -p webdav/config
    cd webdav
  2. Create the script needed to run the container

    Save the following script as webdav_run.sh:

    webdav_run.sh
    # To create this script use your text editor application, for example Nano
    IDu=$(id -u $(logname)) # Saves the logged in user id in the IDu variable
    IDg=$(id -g $(logname)) # Saves the logged in user group in the IDg variable
    docker run -d \
    -p 0.0.0.0:873:80 \
    --hostname=webdav \
    --name=webdav \
    -v $PWD/data:/webdav \
    -v $PWD/config:/config \
    -e TZ="Europe/Amsterdam" \
    -e USER_UID=$IDu \
    -e USER_GID=$IDg \
    -e WHITELIST='192.168.1.*|172.16.1.*' \
    -e READWRITE=true \
    jgeusebroek/webdav
    # IMPORTANT: Please read the instructions below
    Instructions:
    • Optional Replace docker with podman if needed
    • Required Replace port number 873 of 0.0.0.0:873 (on the left side of :) with a port number that is available if needed
    • Optional Replace $PWD/data with the location of your data if needed. This can be a fileserver mount
    • Required Remove the -v $PWD/config:/config \ line if you want to use the default user webdav and password vadbew. Else you need to use the htpasswd package and follow the instructions here
    • Required Replace Europe/Amsterdam with your own timezone
    • Required Replace 192.168.1.*|172.16.1.* with a list of IP’s in the form of a regular expression which are then whitelisted
  3. Run the script to create the container

    Run the following command:

    # Open your terminal application
    sudo sh webdav_run.sh

    The image jgeusebroek/webdav is automatically pulled and the container is created.

  4. Check the results

    If needed you can check if the container is running properly.

    Now you can use WebDAV to create, change and move documents on a server.

Comments

    No comments found for this note.

    Join the discussion for this note on Github. Comments appear on this page instantly.

    Copyright 2021- Fiction Becomes Fact