1. The problem I’m having:
I am trying to build a custom container image using caddy:2.1.0-builder and getting “/bin/sh: xcaddy: not found”. My Dockerfile:
FROM caddy:2.1.0-builder AS builder
RUN xcaddy build \
--with github.com/mholt/caddy-ratelimit@v0.1.0
FROM caddy:2.1.0
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
I haven’t used Docker all that much so it is quite possible I am doing something stupid.
2. Error messages and/or full log output:
/bin/sh: xcaddy: not found
docker build -t caddy:latest .
[+] Building 2.4s (7/8) docker:orbstack
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 252B 0.0s
=> [internal] load metadata for docker.io/library/caddy:2.1.0 2.1s
=> [internal] load metadata for docker.io/library/caddy:2.1.0-builder 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [builder 1/2] FROM docker.io/library/caddy:2.1.0-builder 0.0s
=> CACHED [stage-1 1/2] FROM docker.io/library/caddy:2.1.0@sha256:9ee709b080aacb1a5cae6c4cb654d950f1ded75d7a2277a792860bb28134158e 0.0s
=> ERROR [builder 2/2] RUN xcaddy build --with github.com/mholt/caddy-ratelimit@v0.1.0 0.2s
------
> [builder 2/2] RUN xcaddy build --with github.com/mholt/caddy-ratelimit@v0.1.0:
0.150 /bin/sh: xcaddy: not found
------
Dockerfile:3
--------------------
2 |
3 | >>> RUN xcaddy build \
4 | >>> --with github.com/mholt/caddy-ratelimit@v0.1.0
5 |
--------------------
ERROR: failed to solve: process "/bin/sh -c xcaddy build --with github.com/mholt/caddy-ratelimit@v0.1.0" did not complete successfully: exit code: 127
3. Caddy version:
docker.io/library/caddy:2.1.0-builder
4. How I installed and ran Caddy:
a. System environment:
Mac OS 15.4. Apple M3 Max.
Docker version 28.0.4, build b8034c0
5. Links to relevant resources:
https://hub.docker.com/_/caddy
Thanks