Closed samcro1967 closed 3 years ago
When in Docker, you want to be proxying to the internal port, i.e. 1224 it looks like, not the port you bound to the host (8888).
I changed it to that and tested. It did not work. I am not sure I understand how that would work. As I understand docker, the dozzle container listens on the port exposed externally to the container, 8888. Port 1224 is not exposed externally and would not be accessible outside the dozzle container on it's IP of 172.21.0.2 for Caddy to access.
When one container proxies to another, it uses Docker's internal networking. Any docker container in the same network as another can connect to the ports they listen on. The port mapping to the host is for connections from outside that docker network.
Other things I'm seeing in your docker labels that don't make sense:
tls off
is not an option in Caddy v2, that was something from v1. See https://caddyserver.com/docs/caddyfile/directives/tls
caddy.address="local.dozzle"
this isn't right, please check the README of this repo for how site blocks are defined. You probably want caddy: "http://local.dozzle"
instead.
Thanks you for all of the help and apologize for the newbie questions. Adding http to the caddy label has it working internally.
I double checked the README of this repo and all of the examples show example.com in the server block. without http. Want to make sure I am not missing something and am looking at the right documentation. Might explain why I am struggling.
Hoping maybe it has examples of mixing internal http and external https sites like you can in Caddyfile. I tried the below following the README, but it breaks the internal site and the external loads a blank white page.
labels:
{{upstreams http 1224}}
I don't think you need http here, btw. It's the default.
cadddy.tls_1= "user@domain.net"
You got a typo, 3 d
s.
What's in your logs?
If you use caddy_0
for a first site, then you need to use caddy_0
again for each subsequent label referring to the same site.
I saw that and updated, but still no joy. It does not like the block, but not sure why. So everything with caddy_0 would go into 1 block, and everything with caddy_1 goes into another block if I understand correctly?
Is this the proper way to replicate Dockerfile syntax below to container labels to get the same result? I am not seeing an example of this in the README file, but I may not know what I am looking for.
Dockerfile syntax
dozzle.domain.net http://local.dozzle {
reverse_proxy host ip"port
}
Updated Labels
labels:
- caddy_0= "http://local.dozzle"
- caddy.reverse_proxy_0= "{{upstreams http 1224}}"
- caddy_1= "dozzle.domain.net"
- caddy.reverse_proxy_1= "{{upstreams http 1224}}"
- caddy.tls_1= "user@domain.net"
I think you misunderstood. If you use caddy_0
then you need to then use caddy_0.reverse_proxy
for directives that go inside that.
Ah, you are correct. I did not interpret your guidance correctly. Changing it to the updated labels below solved it. Both internal and external is now working. Thanks!
labels:
- caddy_0= "http://local.dozzle"
- caddy_0.reverse_proxy= "{{upstreams http 1224}}"
- caddy_1= "dozzle.domain.net"
- caddy_1.reverse_proxy= "{{upstreams http 1224}}"
- caddy_1.tls= "user@doamin.net"
I am currently running the official latest caddy image with the Caddyfile at the bottom and it is working as expected. Trying to migrate to caddy-docker-proxy, but am not having any luck. I am not able to access local.dozzle. The resulting CaddyFile is pointing at the docker container IP address (172.21.0.2) instead of the docker host IP (192.168.1.104). Not sure how to make it listen on the host IP. I am probably just missing something obvious in the readme, but nothing is jumping out at me.
docker-compose.yml
Caddy Logs
CaddyFile