Unable to build fresh install, not sure if part of the current libdns issue

1. The problem I’m having:

I am trying to set up caddy for the first time as a reverse proxy for various services on my QNAP TS-464 NAS. I have followed primarily Jim’s Garage’s tutorial, but when I run the build, it starts outputting “go: downloading xxxxxxxxxx” with “xxxxxxxx” being various githubs and golang urls. I saw a mention that there is an issue with libgen currently (at least with Porkbun) and I don’t know enough to saw if this output is indicative of that issue or not. I’m hesitant to let it run as I’m not sure quite what it’s downloading and if it’s going through every GitHub page…

2. Error messages and/or full log output:

Sending build context to Docker daemon  22.02kB
Step 1/4 : FROM caddy:builder AS builder
 ---> bf50d0324495
Step 2/4 : RUN xcaddy build     --with github.com/caddy-dns/porkbun
 ---> Running in 314fb703fa4d
2025/05/06 22:37:41 [INFO] absolute output file path: /usr/bin/caddy
2025/05/06 22:37:41 [INFO] Temporary folder: /tmp/buildenv_2025-05-06-2237.1307473764
2025/05/06 22:37:41 [INFO] Writing main module: /tmp/buildenv_2025-05-06-2237.1307473764/main.go
package main

import (
	caddycmd "github.com/caddyserver/caddy/v2/cmd"

	// plug in Caddy modules here
	_ "github.com/caddyserver/caddy/v2/modules/standard"
	_ "github.com/caddy-dns/porkbun"
)

func main() {
	caddycmd.Main()
}
2025/05/06 22:37:41 [INFO] Initializing Go module
2025/05/06 22:37:41 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
go: to add module requirements and sums:
	go mod tidy
2025/05/06 22:37:41 [INFO] Pinning versions
2025/05/06 22:37:41 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -v github.com/caddyserver/caddy/v2@v2.10.0 
go: downloading github.com/caddyserver/caddy/v2 v2.10.0
go: downloading github.com/caddyserver/certmagic v0.23.0
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/prometheus/client_golang v1.19.1
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/quic-go/quic-go v0.50.1
go: downloading go.uber.org/zap v1.27.0
go: downloading go.uber.org/zap/exp v0.3.0
go: downloading golang.org/x/sys v0.31.0
go: downloading golang.org/x/term v0.30.0
go: downloading golang.org/x/time v0.11.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.48.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.35.1

3. Caddy version:

I don’t think this is relevant, but since it’s the latest, that would be 2.10.0.

4. How I installed and ran Caddy:

I followed this video: https://www.youtube.com/watch?v=ZOtUco5EwoI . All the commands are files are listed below.

Docker file:

FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/porkbun
FROM caddy:latest

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

a. System environment:

Using Docker that came built in with the WNAP TS-464. I am SSH’d in and running it via terminal. The QNAS is running QuTShero h5.2.4.3079

b. Command:

 DOCKER_BUILDKIT=0 docker build /share/ZFS19_DATA/Container/caddy

c. Service/unit/compose file:

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/blue/containers/portainer/portainer-data:/data
    networks:
      - caddy
    ports:
      - 9000:9000

  caddy:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: caddy
    restart: unless-stopped
    ports:
      #- 2019:2019 # remove if you do not want admin API
      - 80:80
      - 443:443
    volumes:
      - /share/ZFS19_DATA/Container/caddy/Caddyfile:/etc/caddy/Caddyfile
      - /share/ZFS19_DATA/Container/caddy/site:/srv
      - /share/ZFS19_DATA/Container/caddy/caddy_data:/data
      - /share/ZFS19_DATA/Container/caddy/caddy_config:/config
    networks:
      - caddy # add other containers onto this network to use dns name

volumes:
  caddy-config:
  caddy-data:

# create this first before running the docker-compose - docker network create caddy
networks:
  caddy:
    external: true

d. My complete Caddy config:

{
        admin 0.0.0.0:2019
}

# globally
{
        acme_dns porkbun {
                        api_key {env.PORKBUN_API_KEY}
                        api_secret_key {env.PORKBUN_API_SECRET_KEY}
        }
}

*.{
        tls {
                dns porkbun {env.PORKBUN_API_KEY}
                propagation_delay 2m
                resolvers 1.1.1.1
        }

        @caddy host caddy..com
        handle @caddy {
                root * /share/ZFS19_DATA/Container/caddy
                php_fastcgi localhost:80
                file_server
        }

        @portainer host portainer..com
        handle @portainer {
                reverse_proxy https://portainer:9000 {
                    transport http {
                            tls
                            tls_insecure_skip_verify
                    }
                }
        }

5. Links to relevant resources:

Watch this issue

and this PR

For now, use Caddy 2.9.4.

This Dockerfile isn’t complete. See the documentation on Docker Hub.

https://hub.docker.com/_/caddy/

1 Like

Thank you, so it is related to that issue, great to have confirmation!

I did try plugging in 2.9.4, but was getting a similar output, but that may be related to the incomplete Dockerfile you mentioned, which is weird as mine looks almost identical to the one referenced in the video.. but thanks for that too, I’ll look that over and give 2.9.4 another go!

update: tbh I’m not sure what’s missing from the Dockerfile? Looking at the documentation and several examples, mine is exactly the same aside from me only installing the pork bun module

Ah, sorry, my eye missed the second FROM line. I’m used to searching for an empty line.

1 Like

no worries, I didn’t realize it was smashed together like that

alright, I’m making progress and learned that what I took as erroneous downloads and errors weren’t. The red text and seemingly unrelated pages being downloaded led me to think it’s an error when they were really just dependencies. I’ve successfully been able to build the image, but running into issues composing it due to zfs and permissions

1 Like

Got it built! For anyone else struggling with this on a QNAP NAS, after you build it using the command in my first post, you’ll actually get errors when trying to compose it. The solution is to go to Container Station > Images and you should see your caddy image(easily to ID if you tagged it when building). Just hit Play/Start and CS will spin it up! I successfully got the welcome page, but still not able to use the address to get to it, but working on pinpointing why

2 Likes

I’m no expert, but I used nmap from outside my network and it’s reporting 80 and 443 are closed, even though they’re open on my router. I’ll have to contact my ISP and see if they have it blocked or something. Anyways, my caddy specific issue has been figured out (so far)!

1 Like