Can cloudflared egress route to the docker name

Super general question. I have the cloudflared container in my docker system assigned to the host network. Using the zero trust routing, can I route it using just the container name, eg.. instead of saying my.domainname --> "hxxp://192.168.0.3:40400" can I just say my.domainname --> "hxxp://dockername" and let it figure itself out?
3 Replies
foutkassir
foutkassir16mo ago
@DocNasty since you are refering to host network you have to do something like http://host.docker.internal:4040 or http://0.0.0.0:4040 what I would suggest is to have docker compose which would contain your service alongside cloudflared container. at this stage they do share same bridge and you can achieve reaching the service by name. consider the following sample:
services:
web:
[...]
cloudflared:
[...]
services:
web:
[...]
cloudflared:
[...]
you can from cloudflared config yaml or cloudflare one dashboard apply the following my.domainname --> "hxxp://web"
CallMeDoc
CallMeDocOP16mo ago
Thank you @foutkassir , I'll play with this a bit from the one dashboard. I just need to make sure they are in the same network partition..
foutkassir
foutkassir16mo ago
@DocNasty Just to clarify one point, what you could do it create a network bridge called cloudflared-network and do the following docker network create --driver=bridge --subnet=172.20.0.0/16 --gateway=172.20.0.1 cloudflared-network and then if you want to redirect traffic to localhost meaning host you do the following http://172.20.0.1:4040. I don't think we can do such thing http://0.0.0.0:4040 but that's what I did for my local app available on host only

Did you find this page helpful?