I have tried stopping and starting the container. I have removed and recreated the container. I have removed the container image and re-downloaded it. If I remove the container, the image, wait several hours, and try again, it then picks up the changes I made to Caddyfile 8 hours ago.
I would tend to think this is a Docker issue with its local cache, but I run 30+ different containers and do this all the time without issues on all of them, except this one
I tried this also, “docker exec caddy2 caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile”, but since the container crashes, it is not able to run on a stopped container.
Like I commented previously, I am using port 90 as I am running caddy v1 on the machine in production. Just trying to get a working caddyfile first. I also mentioned I tried removing the container and the image with no luck.
I had been pruning images and containers, but had not tried docker system prune. That had no effect though. I checked to make sure the container is not creating an ephemeral volumes where it might be sticking the caddyfile on first run, and there are none.
I restarted Docker itself and Docker now no longer sees the local drives. I had to reboot the host for them to return to Docker. I have seen this a few times before. I think this is a Docker issues at this point.
If you’re still having issues with the volumes etc, you can change the initial command to sh -c 'cat /etc/caddy/Caddyfile' to spit out what config the container is seeing. Would help confirm whether it’s some weird caching issue or not.
Just to posit a possible cause - because Docker volume mounts use inode references, if you mount a file directly, and you edit it with a method that renames/moves files (such as vim's default behaviour - see backup, backupcopy, writebackup options), the inside of the container will retain the original file, not the one written in its place on the host filesystem. This could cause the behaviour you’re seeing.
This is definitely a Docker issue. After a host reboot it worked as expected. The past several releases for Docker on Windows have had numerous bugs with file system mounts over the past 6 months The releases have been very unstable.