Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/config/caddy/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /home/config/caddy/Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), flags: 0x5000: 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
I have also tried non-modified yaml from this link and also some other guides. I have never experienced error like this, but I’m not Docker expert. Need some help please
Thank you and sorry for late response. I did check that and docker compose up is creating a folder called Caddyfile. I have manually deleted the folder and created a file with the same name. Is this correct way or I’m missing something?
I tried to put some proxy hosts and now I’m getting different errors (DNS), but feels too early to post that here. I’ll keep trying myself, but would like to know have I done something wrong to get a folder instead of a file
Yep. With a bind mount you’re telling Docker to take a file or a folder from the host and put it in the container.
Naturally, the Caddy container expects a Caddyfile there, so you need to make a Caddyfile and put it there on the host so Docker can find that file and make it available inside the container, as you’ve configured it.
I imagine the reason it errored is because you had nothing on the host. Docker assumes you’ll want a folder and makes one for you. This immediately fails for the reason you’ve seen above.