I am having trouble getting this to mount. I am runing Docker/Portainer in a VM, and using Docker Compose within Portainer. It isn’t able to access any of these mountpoints I’ve tried, but works fine with the /data folder being mapped to a persistent volume. I thought there was a way to also put the Caddyfile into that persistent storage volume so I can update it and it persists.
I’ve tried that. Portainer itself keeps the docker-compose.yml files in its own folders (portainer/compose/###/). I’ve placed the Caddyfile there next to the docker-compose and it throws the same error.
container process: error during container init: error mounting "/data/compose/186/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /data/compose/186/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
As Keep Caddy Running — Caddy Documentation says, literally put the Caddyfile and docker-compose.yml files next to eachother. I’m not sure why that would be a problem. Both are config and should be treated as such. Config is not data, it doesn’t go in a data volume.
This is probably the case outside of Portainer, but within Portainer paths are working differently. Please direct me to a working Portainer compose file for Caddy that addresses this if possible. I use data volumes for all sorts of purposes, and keeping some specific config files in them for a specific container makes some tasks simpler.