How to use webdav on caddy docker-compose

Hello! Friend.

I use this caddy. Docker Hub
But webdav can not work.
Can you help me ?

I read this page
Module http.handlers.webdav does not come with Caddy.
Then, how to add webdav in caddy docker-compose ?

Did the instructions on that page not work? Under “Adding custom Caddy modules”.

How to add it to docker-compose.yml ?

root@localhost:~# docker-compose up --build
Creating network "root_default" with the default driver
Building caddy
Step 1/4 : FROM caddy:builder AS builder
builder: Pulling from library/caddy
188c0c94c7c5: Already exists
0ef7d3d256c8: Already exists
de9db76c5a1d: Already exists
f5b5e3429cf3: Already exists
07aa6a096151: Already exists
58fe1a629618: Pull complete
e1da5ba704ae: Pull complete
572698d0ecf1: Pull complete
Digest: sha256:11b6dc688f10fd45996d660117a4567192599b9dc33e0ed69376f3e771473085
Status: Downloaded newer image for caddy:builder
 ---> d52e2ef96ee9
Step 2/4 : RUN xcaddy build     --with github.com/mholt/caddy-webdav
 ---> Running in b380fb156d70
2020/12/07 17:12:40 [INFO] Temporary folder: /tmp/buildenv_2020-12-07-1712.680422176
2020/12/07 17:12:40 [INFO] Writing main module: /tmp/buildenv_2020-12-07-1712.680422176/main.go
2020/12/07 17:12:40 [INFO] Initializing Go module
2020/12/07 17:12:40 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
2020/12/07 17:12:40 [INFO] Pinning versions
2020/12/07 17:12:40 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.2.1 
go: downloading github.com/caddyserver/caddy/v2 v2.2.1
go: downloading go.uber.org/zap v1.15.0
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading github.com/caddyserver/certmagic v0.12.0
go: downloading github.com/prometheus/client_golang v1.7.1
go: downloading go.uber.org/atomic v1.6.0
go: downloading github.com/klauspost/cpuid v1.2.5
go: downloading github.com/prometheus/common v0.10.0
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/mholt/acmez v0.1.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/protobuf v1.4.2
go: downloading github.com/miekg/dns v1.1.30
go: downloading golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/prometheus/procfs v0.1.3
go: downloading golang.org/x/net v0.0.0-20200707034311-ab3426394381
go: downloading google.golang.org/protobuf v1.24.0
go: downloading github.com/libdns/libdns v0.1.0
go: downloading go.uber.org/multierr v1.5.0
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/beorn7/perks v1.0.1
2020/12/07 17:13:04 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/mholt/caddy-webdav 
go: downloading github.com/mholt/caddy-webdav v0.0.0-20200916200058-c949b3226234
go: github.com/mholt/caddy-webdav upgrade => v0.0.0-20200916200058-c949b3226234
go: downloading github.com/google/cel-go v0.5.1
go: downloading google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98
go: downloading github.com/smallstep/certificates v0.15.4
go: downloading github.com/lucas-clemente/quic-go v0.18.0
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading github.com/smallstep/cli v0.15.2
go: downloading github.com/marten-seemann/qpack v0.2.0
go: downloading github.com/smallstep/truststore v0.9.6
go: downloading github.com/marten-seemann/qtls-go1-15 v0.1.0
go: downloading github.com/marten-seemann/qtls v0.10.0
go: downloading github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f
go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/urfave/cli v1.22.2
go: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
go: downloading github.com/manifoldco/promptui v0.7.0
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
go: downloading github.com/mattn/go-colorable v0.1.6
go: downloading github.com/lunixbochs/vtclean v1.0.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
go: downloading github.com/russross/blackfriday v1.5.2
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/Masterminds/sprig/v3 v3.1.0
go: downloading github.com/smallstep/nosql v0.3.0
go: downloading go.step.sm/crypto v0.6.0
go: downloading github.com/spf13/cast v1.3.1
go: downloading github.com/imdario/mergo v0.3.9
go: downloading github.com/huandu/xstrings v1.3.1
go: downloading github.com/mitchellh/copystructure v1.0.0
go: downloading github.com/Masterminds/goutils v1.1.0
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/dgraph-io/badger v1.5.3
go: downloading github.com/google/uuid v1.1.1
go: downloading gopkg.in/square/go-jose.v2 v2.5.1
go: downloading go.etcd.io/bbolt v1.3.2
go: downloading github.com/mitchellh/reflectwalk v1.0.0
go: downloading github.com/Masterminds/semver/v3 v3.1.0
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2
go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9
go: downloading github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200413122845-09dd2e1a4195
go: downloading github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3
go: downloading github.com/DataDog/zstd v1.4.1
go: downloading github.com/golang/snappy v0.0.1
go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
go: downloading google.golang.org/grpc v1.27.1
2020/12/07 17:13:19 [INFO] Build environment ready
2020/12/07 17:13:19 [INFO] Building Caddy
2020/12/07 17:13:19 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath 
go: downloading github.com/jsternberg/zap-logfmt v1.2.0
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/yuin/goldmark v1.2.1
go: downloading github.com/naoina/toml v0.1.1
go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
go: downloading github.com/klauspost/compress v1.11.0
go: downloading github.com/alecthomas/chroma v0.8.0
go: downloading github.com/go-chi/chi v4.1.2+incompatible
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading github.com/rs/xid v1.2.1
go: downloading github.com/naoina/go-stringutil v0.1.0
go: downloading github.com/sirupsen/logrus v1.4.2
go: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
go: downloading github.com/dlclark/regexp2 v1.2.0
2020/12/07 17:15:11 [INFO] Build complete: caddy
2020/12/07 17:15:11 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2020-12-07-1712.680422176
Removing intermediate container b380fb156d70
 ---> 2b37c05f3f68

Step 3/4 : FROM caddy:builder
 ---> d52e2ef96ee9
Step 4/4 : COPY --from=builder /usr/bin/caddy /usr/bin/caddy
 ---> fdd48aec5c83

Successfully built fdd48aec5c83
Successfully tagged root_caddy:latest
caddy exited with code 0
caddy exited with code 0
caddy exited with code 0
caddy exited with code 0
caddy exited with code 0
caddy exited with code 0
caddy exited with code 0
  caddy:
    # image: caddy
    build: /data/docker/data/caddy
    #  context: /data/docker/data/caddy/
    #  dockerfile: Dockerfile
    container_name: caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /data/docker/data/caddy/Caddyfile:/etc/caddy/Caddyfile
      - /data/www:/www
      - /data/docker/data/caddy/caddy_data:/data
      - /data/docker/data/caddy/caddy_config:/config
    depends_on:
      - v2ray
      - aria2-pro
      - filebrowser
      - webdav
FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/mholt/caddy-webdav

FROM caddy:builder

COPY --from=builder /usr/bin/caddy /usr/bin/caddy
1 Like

It’s not working

What’s not working? Just saying “it’s not working” doesn’t tell us anything at all. Please be specific.

This topic was automatically closed after 30 days. New replies are no longer allowed.