Okay, this sounds very much like traefik and caddy aren’t in the same docker network.
You can check that for yourself by comparing the networks of both your containers via
docker inspect --format='{{range $k,$v := .NetworkSettings.Networks}}{{println $k}}{{end}}' your_container
## or if you have `jq` installed and want *all* network details, you could just
docker inspect --format "{{json .NetworkSettings.Networks}}" your_container | jq
## or if you are already familiar what you need to look for
docker inspect --format "{{.NetworkSettings.Networks}}" your_container
I can write a full explanation and tutorial if needed, just let me know.
Considering your system already has some docker-compose stacks that are being proxied by traefik, I would recommend looking at them first after reading Networking in Compose | Docker Documentation.
The really short form would be:
Your traefik stack might have something like
networks:
proxy:
name: proxy
and your other stack might need
networks:
proxy:
external: true
and for both traefik and the container you want to proxy, you’ll need to add networks:
services:
sites:
image: 'caddy:alpine'
networks:
- proxy
This way they share the same docker network proxy
and can reach each other