1. The problem I’m having:
i have recently built a server from myself. previously i was hosting from my raspberry pi.
i am now looking to rebuild my custom docker image with a few plugins.
however, whenever i build it (no matter whether with docker build or docker compose build) i get a fatal error 2
dockerfile:
ARG CADDY_VERSION=2
FROM caddy:${CADDY_VERSION}-builder AS builder
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.8.1 \
--with github.com/caddy-dns/cloudflare \
--with github.com/mholt/caddy-dynamicdns
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
CMD ["caddy", "docker-proxy"]
here’s the log from when i run docker build from shortly before the Error:
#0 45.81 go: found github.com/Azure/go-ansiterm/winterm in github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161
#0 45.88 2023/04/01 18:49:00 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath
#0 77.81 # go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
#0 77.81 /go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.10.0/internal/otlpconfig/envconfig.go:84:13: undefined: envconfig.WithTLSConfig
#0 77.81 /go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.10.0/internal/otlpconfig/envconfig.go:85:13: undefined: envconfig.WithTLSConfig
#0 86.44 2023/04/01 18:49:41 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2023-04-01-1848.3643595957
#0 86.44 2023/04/01 18:49:41 [FATAL] exit status 2
------
failed to solve: executor failed running [/bin/sh -c xcaddy build --with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.8.1 --with github.com/caddy-dns/cloudflare --with github.com/mholt/caddy-dynamicdns]: exit code: 1
2. Error messages and/or full log output:
#0 45.81 go: found github.com/Azure/go-ansiterm/winterm in github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161
#0 45.88 2023/04/01 18:49:00 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath
#0 77.81 # go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
#0 77.81 /go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.10.0/internal/otlpconfig/envconfig.go:84:13: undefined: envconfig.WithTLSConfig
#0 77.81 /go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace@v1.10.0/internal/otlpconfig/envconfig.go:85:13: undefined: envconfig.WithTLSConfig
#0 86.44 2023/04/01 18:49:41 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2023-04-01-1848.3643595957
#0 86.44 2023/04/01 18:49:41 [FATAL] exit status 2
------
failed to solve: executor failed running [/bin/sh -c xcaddy build --with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.8.1 --with github.com/caddy-dns/cloudflare --with github.com/mholt/caddy-dynamicdns]: exit code: 1
3. Caddy version:
docker-compose building with xcaddy via a dockerfile:
ARG CADDY_VERSION=2
FROM caddy:${CADDY_VERSION}-builder AS builder
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.8.1 \
--with github.com/caddy-dns/cloudflare \
--with github.com/mholt/caddy-dynamicdns
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
CMD ["caddy", "docker-proxy"]
4. How I installed and ran Caddy:
a. System environment:
in a Docker Container on NixOS Linux on a Ryzen 7 2700x
b. Command:
docker build ./build-dockerfile/ --pull --no-cache
c. Service/unit/compose file:
dockerfile:
ARG CADDY_VERSION=2
FROM caddy:${CADDY_VERSION}-builder AS builder
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2@v2.8.1 \
--with github.com/caddy-dns/cloudflare \
--with github.com/mholt/caddy-dynamicdns
FROM caddy:${CADDY_VERSION}-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
CMD ["caddy", "docker-proxy"]
d. My complete Caddy config:
not even getting to this step lol