Hey guys. I have a platform where Caddy is running as a reverse proxy on Ubuntu but the app servers that it proxies to are on the same machine but running in a Docker container (Rails app deployed via dokku).
I want to be able to call the Caddy Admin API from the Rails app that lives in Docker but localhost:2019 will mean something different inside of Docker.
Does anyone have any ideas on how to call the Caddy Admin API from a Docker containers on the same computer?
You can also change the admin listen address to 0.0.0.0:2019 and not make a host port mapping for 2019 so only other containers in the same network can talk to it.
I’ve also heard there’s a host.docker.internal name that Docker’s DNS will resolve to the host’s IP address in future, but I’m pretty sure that’s not live yet on Docker for Linux (I believe it works for Mac and Windows… which I can’t help feel is bass ackwards… But hey).
Guys… thank you for responding. I am going to try the 0.0.0.0:2019 idea which seems like the most direct solution given my very limited knowledge of Docker.
I saw the bold tag and thought that was the tag that has this commit, but it was committed in April, before the v2 release. So… I dunno what to make of that. It should be working.
I’m running a docker container just to explore how to add new sites using the API but I haven’t been able to make it work. So far I’ve tested the 2.0.0-alpine, 2.1.0-beta.1, and 2.1.0-beta.1-alpine images and seeing different behavior.
Note that I am running the container in port 8181 instead of port 80.
Oh, it looks like Caddy is redirecting you from /config to /config/. Just make a request for /config/ instead I guess, or use the -L curl flag to follow the redirect (-L for Location header)