Mount any of these two volumes:
./path/to/dir:/data is the root folder that nginx will serve for WebDAV content (/data)../config:/config contains useful configuration files for nginx as well as the overall container. If you mount /config to an empty folder, the folder will be initialized with default empty files that you will be able to edit. See the next section for more information.These are environment variables you can set, and what they do.
PUID=1000 user id with read/write access to ./path/to/dir:/data volume. Nginx will use the same to be able to read/write to the folder.PGID=1000 group id with read/write access to ./path/to/dir:/data volume. Nginx will use the same to be able to read/write to the folder.TZ=Europe/Berlin specifies timezone for the underlying GNU/Linux system.WEBDAV_USERNAME=user to set a single username to access WebDAV. Ignored if WEBDAV_PASSWORDis not set, ignored if /config/nginx/htpasswd is provided.WEBDAV_PASSWORD=password to set the password to the single username to access WebDAV. Ignored if WEBDAV_USERNAMEis not set, ignored if /config/nginx/htpasswd is provided.SERVER_NAMES=localhost,ineed.coffee comma separated hostnames for the server.TIMEOUTS_S=1200 expressed as seconds, sets at the same time various nginx timeouts: send_timeout, client_body_timeout, keepalive_timeout, lingering_timeout.CLIENT_MAX_BODY_SIZE=120M limits file upload size to the expressed value, which must end wither with M(egabytes) or G(igabytes).The container path /config is configured as unnamed/anonymous volume. Besides that, it contains the following paths and files:
/config/custom-cont-init.d to host your own custom scripts that run at startup./config/custom-services.d to host your own service files./config/nginx to host custom configuration files for nginx, namely:
/config/nginx/http.conf included at the end of nginx.conf http directive./config/nginx/server.conf included at the end of nginx.conf server directive./config/nginx/http.conf included at the end of nginx.conf location directive.Furthermore, if you provide an htpasswd file at /config/nginx/htpasswd, the container will use it for authentication.
Tha htpasswd is the Apache HTTP compatible flat file to register usernames and passwords. If you provide one, you can tell the container who your username and passwords are.
Please note that providing an htpasswd file will make the container ignore any supplied env variable WEBDAV_USERNAME and WEBDAV_PASSWORD.
Please note that all users have the same access levels.
Removing the file at /config/nginx/htpasswd will cause the container to use any provided WEBDAV_USERNAME and WEBDAV_PASSWORD variables.
Multi-user support can be setup with only one container.
Be sure that:
htpasswd file with your users and passwords (more details can be found in The /config volume)./custom-cont-init.d:/custom-cont-init.d (more details can be found in The /config volume)40-user_dir (from this repository)docker-compose up -d --force-recreate nginxwebdavThe log of the container should contain some information about the custom init-script:
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] Files found, executing
[custom-init] 40-user_dir: executing...
change root from /data to /data/$remote_user
[custom-init] 40-user_dir: exited 0
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
WebDAV with basic login and custom folders per user tested with the integrated web-client, Filestash.app, Dolphin (KDE file manager; How-To from NextCloud documentation) and Linux mount (davfs; How-To from NextCloud documentation).
You can test this image quickly under the following assumptions:
/mnt/c/Users/Admin/data folder,user1 with password password1,127.0.0.1:8080.docker container run -d --rm \
--publish 8080:80 \
-v /mnt/c/Users/Admin/data:/data \
-e WEBDAV_USERNAME=user1 \
-e WEBDAV_PASSWORD=password1 \
-e PUID=1000 \
-e PGID=1000 \
diegofazio/webdav
Then you can visit the server using http://127.0.0.1:8080.
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=<your wsl ip>
Running docker without -d, You can exit the quick test by hitting CTRL-C. The container will exit and be removed.
Content type
Image
Digest
sha256:51edcaf96…
Size
204.5 MB
Last updated
almost 2 years ago
docker pull diegofazio/webdav