I’m building “successfully” a Caddy image with simply adding the module(s) or using xcaddy. Everytime I start a container after my build I get:
ERROR: for 7d9210273fce_caddy Cannot start service caddy: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "caddy": executable file not found in $PATH: unknown
I can change the run command path like:
command: caddy run --config /config/caddy-config.json
But that gives me:
ERROR: for 7d9210273fce_caddy Cannot start service caddy: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/bin/caddy": permission denied: unknown
2. Error messages and/or full log output:
Example 1:
ERROR: for 7d9210273fce_caddy Cannot start service caddy: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "caddy": executable file not found in $PATH: unknown
Example 2:
ERROR: for 7d9210273fce_caddy Cannot start service caddy: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/bin/caddy": permission denied: unknown
3. Caddy version:
2.7.5 (and lower same result)
4. How I installed and ran Caddy:
This is the last build I used. I also tried with ADD [caddy-download-page-link>] /usr/bin/caddy with the same result
FROM caddy:2.7.5-builder-alpine AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
FROM caddy:2.7.5-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
When using code blocks on the forums (or markdown in general), the ``` must be on its own lines. I fixed your post this time, but please mind your formatting next time.
That should work fine.
Are you sure this is correct? Did you tag your image that way? How did you actually build your image from your Dockerfile?
Normally you’d use the build: config in your compose.yml.
Yes the image name is fine; I have a docker image builder script that all magic for me for what I need in my own docker registry to keep things clear. If you see that image builder you would be amazed, trust me, making images for me is very easy now with all kinds of files/folders/etc for what I need there.
What I just did is build the same way without the -alpine part of the builder, I don’t know what the default image is what Caddy uses but I can look it up.
Because I like to have things right. If I build using -alpine it doesn’t work, so the question is, why not ? Could it be that the -alpine image is broken during the build process @ Docker repo ?