Broke my whole Caddyfile down to this which is the main reason of my problems
:8080
file_server browse
3. The problem I’m having:
I would like the file_server to show my current directory (where my docker-compose.yml and my Caddyfile is in) since I want to share static files (inside a static folder) with some reverse proxies I use. Instead the file_server shows me the directory of the caddy configuration (seems like it has something to do with $HOME)
4. Error messages and/or full log output:
No error message, just wrong directory
5. What I already tried:
I’ve already tried manipulating the root in the Caddyfile with following code:
Yep, that’s the right approach. Docker containers are completely isolated from the host’s filesystem unless you mount volumes.
Caddy will default the root to the current working directory. When running in Docker, that’ll be /. This is actually something I’m looking to fix now, because it doesn’t make sense for the default root to be /. So thanks for making me spend a minute to think!
Maybe this will help anyone who will be encountered with this thread in future:
3 days ago there was a change for caddy:2.0.0-alpine which changed the standard working direction from root (/) to /srv (to avoid exposing / directory).
Be aware that you now need to either place the static folder inside the /srv directory, or change the root path back to / by using “root * /” inside the Caddyfile (I used it right after declaring the site address, in my case “:8080”)