cloudflared tunnel via Docker

Hi! I am using cloudflared in a Docker compose file with the following configuration.
version: '1.0'
services:
app:
container_name: XXX
image: ghcr.io/XXX/XXX:main
# restart: unless-stopped
ports:
- "3000:3000"
networks:
- app
tunnel:
container_name: cloudflared-tunnel
image: cloudflare/cloudflared
# restart: unless-stopped
command: tunnel run
environment:
- TUNNEL_TOKEN=XXXX
networks:
- app

networks:
app:
name: app
version: '1.0'
services:
app:
container_name: XXX
image: ghcr.io/XXX/XXX:main
# restart: unless-stopped
ports:
- "3000:3000"
networks:
- app
tunnel:
container_name: cloudflared-tunnel
image: cloudflare/cloudflared
# restart: unless-stopped
command: tunnel run
environment:
- TUNNEL_TOKEN=XXXX
networks:
- app

networks:
app:
name: app
My problem here is that it keeps throwing the following errors even though it seems to work just fine (request come through and app is served correctly). However, when enabling "restart: unless-stopped", it doesn't work as it keeps restarting. Wasn't able to find anything on this. Really appreciate the help!
cloudflared-tunnel | 2024-03-08T21:01:06Z ERR Request failed error="context canceled" connIndex=1 dest=https://XXXX/ event=0 ip=XXXX type=http
cloudflared-tunnel | 2024-03-08T21:06:05Z ERR error="context canceled" connIndex=1 event=1 ingressRule=2 originService=http://app:3000
cloudflared-tunnel | 2024-03-08T21:01:06Z ERR Request failed error="context canceled" connIndex=1 dest=https://XXXX/ event=0 ip=XXXX type=http
cloudflared-tunnel | 2024-03-08T21:06:05Z ERR error="context canceled" connIndex=1 event=1 ingressRule=2 originService=http://app:3000
2 Replies
Erisa
Erisa9mo ago
"context canceled" sounds like a network disconnect error which may be benign, are you sure those errors correlate to the requests you are interested in sending? Perhaps they are related to other traffic e.g. bots.
However, when enabling "restart: unless-stopped", it doesn't work as it keeps restarting.
That shouldn't be happening, what errors/log output do you get when that happens?
Bjarn
BjarnOP9mo ago
Even with no traffic. Very odd, I’m maybe going to try without docker to see how it affects it. I have no extra logs from the unless stopped flag. I’ll take a look at that tomorrow! Thanks 🙌
Want results from more Discord servers?
Add your server