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


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
Was this page helpful?