Caddy docker container failed

Hello everyone,

I followed this tutorial to make my own caddy image except that I came across this error.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/home/caddy/CaddyFile" to rootfs at "/var/lib/docker/overlay2/a8439dc258b5bbca559539dc3dfbee0ae1bf798c97ab22eed933a33ca5d805af/merged/etc/caddy/Caddyfile" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
ERRO[0000] error waiting for container: context canceled

I run this command.

docker container run -it --name caddy-server -p 80:80 -p 443:443 -v caddy_data:/data -v caddy_config:/config -v $PWD/Caddyfile:/etc/caddy/Caddyfile -e CLOUDFLARE_EMAIL=MyEMail -e CLOUDFLARE_API_TOKEN=MyToken -e ACME_AGREE=true erem/custom-caddy

Thanks for your help.

It seems like you have an uppercase F there. Linux uses a case sensitive filesystem. So when trying to mount Caddyfile, that file does not exist.

Finally I found my error it turns out that I had a Caddyfile folder and not a file.

Thanks for following up!

I like your avatar by the way :slight_smile:

1 Like

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