Mac Docker Desktop Cloudflare Tunnel

What is the name of the domain?

net

What is the issue you’re encountering

As the title explains I am trying to run Cloudflare Tunnel on a mac within docker desktop. I get this is in the log of the container: error="Unable to reach the origin service. & I get “Bad gateway” on any container webpage I try and go to.

What steps have you taken to resolve the issue?

I went back into my stack and made a network and put all my containers on that network.

(I would be will to go through any tutorial that describes my setup of Mac>Docker Desktop>Cloudflare Tunnels.)

This is my compose:

tunnel:
container_name: cloudflared-tunnel
image: cloudflare/cloudflared
command: tunnel --protocol quic --no-autoupdate run
ports:
- 7844:7844
extra_hosts:
- “host.docker.internal:host-gateway”
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
networks:
- cf-tunnel

Try these articles:

Very familiar and have tunnels in other systems that work well using these docs. I am specifically looking to understand the different aspects of using mac docker desktop vs linux.

This may actually help here: Docker Desktop vs Linux Virtual machine running Docker in production - #2 by rofrano - General Discussions - Docker Community Forums

  1. Why is Docker on macOS So Much Worse Than Linux? - DEV Community

Great information again! But even more specifically the networking.

(My cloudflare tunnel from the outside works as expected. The container log has many error.)

ERR Request failed error=“Incoming request ended abruptly: context canceled” connIndex=3…

are you able to post more of the log minus any identifiable ip address?

2024-09-24T00:04:53Z INF Starting metrics server on 127.0.0.1:39155/metrics
2024/09/24 00:04:53 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See UDP Buffer Sizes · quic-go/quic-go Wiki · GitHub for details.
2024-09-24T00:04:53Z INF Registered tunnel connection connIndex=0 connection=f9cea12e-8c86-4fdf-b82a-b63e521c004d event=0 ip=198.41.192.7 location=msp01 protocol=quic
2024-09-24T00:04:55Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:04:55Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:04:55Z INF Retrying connection in up to 2s connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:04:56Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:04:57Z INF Updated to new configuration config=“{"ingress":{"hostname":"ssh.jonyskids.net","originRequest":{},"service":"ssh://localhost:22"},{"hostname":"skidsfin.jonyskids.net","originRequest":{},"service":"http://Localhost:8097"},{"hostname":"portainer.jonyskids.net","originRequest":{},"service":"http://portainer:9002"},{"service":"http_status:404"}],"warp-routing":{"enabled":false}}” version=77
2024-09-24T00:04:58Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.33
2024-09-24T00:04:58Z INF Retrying connection in up to 2s connIndex=1 event=0 ip=198.41.200.33
2024-09-24T00:04:58Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:04:59Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.13
2024-09-24T00:04:59Z INF Retrying connection in up to 2s connIndex=2 event=0 ip=198.41.200.13
2024-09-24T00:05:01Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:05:08Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.107
2024-09-24T00:05:08Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.107
2024-09-24T00:05:08Z INF Retrying connection in up to 4s connIndex=3 event=0 ip=198.41.192.107
2024-09-24T00:05:09Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:05:13Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.73
2024-09-24T00:05:13Z INF Retrying connection in up to 4s connIndex=2 event=0 ip=198.41.200.73
2024-09-24T00:05:13Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.43
2024-09-24T00:05:13Z INF Retrying connection in up to 4s connIndex=1 event=0 ip=198.41.200.43
2024-09-24T00:05:14Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:05:16Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:05:25Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.227
2024-09-24T00:05:25Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.227
2024-09-24T00:05:25Z INF Retrying connection in up to 8s connIndex=3 event=0 ip=198.41.192.227
2024-09-24T00:05:30Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.233
2024-09-24T00:05:30Z INF Retrying connection in up to 8s connIndex=1 event=0 ip=198.41.200.233
2024-09-24T00:05:30Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.113
2024-09-24T00:05:30Z INF Retrying connection in up to 8s connIndex=2 event=0 ip=198.41.200.113
2024-09-24T00:05:30Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:05:30Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:05:35Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:06:08Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.77
2024-09-24T00:06:08Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.77
2024-09-24T00:06:08Z INF Retrying connection in up to 16s connIndex=3 event=0 ip=198.41.192.77
2024-09-24T00:06:13Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.233
2024-09-24T00:06:13Z INF Retrying connection in up to 16s connIndex=2 event=0 ip=198.41.200.233
2024-09-24T00:06:13Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.43
2024-09-24T00:06:13Z INF Retrying connection in up to 16s connIndex=1 event=0 ip=198.41.200.43
2024-09-24T00:06:16Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:06:17Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:06:19Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:06:51Z INF Initiating graceful shutdown due to signal terminated …
2024-09-24T00:06:51Z INF Unregistered tunnel connection connIndex=0 event=0 ip=198.41.192.7
2024-09-24T00:06:51Z ERR Failed to serve quic connection error=“Application error 0x0 (remote)” connIndex=0 event=0 ip=198.41.192.7
2024-09-24T00:06:51Z ERR Serve tunnel error error=“Application error 0x0 (remote)” connIndex=0 event=0 ip=198.41.192.7
2024-09-24T00:06:51Z INF Retrying connection in up to 1s connIndex=0 event=0 ip=198.41.192.7
2024-09-24T00:06:51Z ERR no more connections active and exiting
2024-09-24T00:06:51Z INF Tunnel server stopped
2024-09-24T00:06:51Z ERR icmp router terminated error=“context canceled”
2024-09-24T00:06:51Z INF Metrics server stopped
2024-09-24T00:06:52Z INF Starting tunnel tunnelID=60556ca8-8f0c-4305-aae8-310de52aa25b
2024-09-24T00:06:52Z INF Version 2024.9.1
2024-09-24T00:06:52Z INF GOOS: linux, GOVersion: go1.22.2-devel-cf, GoArch: amd64
2024-09-24T00:06:52Z INF Settings: map[no-autoupdate:true p:quic protocol:quic]
2024-09-24T00:06:52Z INF Environmental variables map[TUNNEL_TOKEN:*****]
2024-09-24T00:06:52Z INF Generated Connector ID: da74af4e-b7a6-4f36-967a-8998804dfee1
2024-09-24T00:06:52Z INF Initial protocol quic
2024-09-24T00:06:53Z INF ICMP proxy will use 172.21.0.8 as source for IPv4
2024-09-24T00:06:53Z INF ICMP proxy will use ::1 in zone lo as source for IPv6
2024-09-24T00:06:53Z INF Starting metrics server on 127.0.0.1:43401/metrics
2024/09/24 00:06:53 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See UDP Buffer Sizes · quic-go/quic-go Wiki · GitHub for details.
2024-09-24T00:06:53Z INF Registered tunnel connection connIndex=0 connection=1e9041f2-b039-4afa-94d8-c7849a3acd86 event=0 ip=198.41.192.37 location=msp01 protocol=quic
2024-09-24T00:06:55Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:06:55Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:06:55Z INF Retrying connection in up to 2s connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:06:57Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:06:57Z INF Updated to new configuration config=“{"ingress":[{"hostname":"skidsmission.jonyskids.net","originRequest":{"access":{"audTag":,"required":false,"teamName":"planetskids"}},"service":"http://transmission:9091"},{"hostname":"prowlarr.jonyskids.net","originRequest":{"access":{"audTag":["817f2ad32b1c088d43d9118b788079cf58facee2a74d15adfa69be0e6571ed18"],"required":true,"teamName":"planetskids"}},"service":"http://prowlarr:9696"},{"hostname":"sonarr.jonyskids.net","originRequest":{"http2Origin":true,"originServerName":"Sonarr.jonyskids.net"},"service":"http://sonarr:8989"},{"hostname":"radarr.jonyskids.net","originRequest":{},"service":"http://radarr:7878"},{"hostname":"ssh.jonyskids.net","originRequest":{},"service":"ssh://localhost:22"},{"hostname":"skidsfin.jonyskids.net","originRequest":{},"service":"http://Localhost:8097"},{"hostname":"portainer.jonyskids.net","originRequest":{},"service":"http://portainer:9002"},{"hostname":"bazarr.jonyskids.net","originRequest":{},"service":"http://bazarr:6767"},{"service":"http_status:404"}],"warp-routing":{"enabled":false}}” version=77
2024-09-24T00:06:58Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.53
2024-09-24T00:06:58Z INF Retrying connection in up to 2s connIndex=1 event=0 ip=198.41.200.53
2024-09-24T00:06:58Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:06:59Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.43
2024-09-24T00:06:59Z INF Retrying connection in up to 2s connIndex=2 event=0 ip=198.41.200.43
2024-09-24T00:06:59Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:07:00Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:07:00Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:07:00Z INF Retrying connection in up to 4s connIndex=3 event=0 ip=198.41.192.67
2024-09-24T00:07:02Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:07:03Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.7
2024-09-24T00:07:03Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.7
2024-09-24T00:07:03Z INF Retrying connection in up to 8s connIndex=3 event=0 ip=198.41.192.7
2024-09-24T00:07:04Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3
2024-09-24T00:07:05Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.233
2024-09-24T00:07:05Z INF Retrying connection in up to 4s connIndex=1 event=0 ip=198.41.200.233
2024-09-24T00:07:05Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.63
2024-09-24T00:07:05Z INF Retrying connection in up to 4s connIndex=2 event=0 ip=198.41.200.63
2024-09-24T00:07:06Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:07:07Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:07:19Z WRN Failed to serve quic connection error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:07:19Z WRN Unable to establish connection. error=“already connected to this server, trying another address” connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:07:19Z INF Retrying connection in up to 16s connIndex=3 event=0 ip=198.41.192.167
2024-09-24T00:07:24Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2 event=0 ip=198.41.200.233
2024-09-24T00:07:24Z INF Retrying connection in up to 8s connIndex=2 event=0 ip=198.41.200.233
2024-09-24T00:07:24Z WRN Failed to create new quic connection error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1 event=0 ip=198.41.200.193
2024-09-24T00:07:24Z INF Retrying connection in up to 8s connIndex=1 event=0 ip=198.41.200.193
2024-09-24T00:07:24Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=1
2024-09-24T00:07:28Z WRN Connection terminated error=“failed to dial to edge with quic: timeout: no recent network activity” connIndex=2
2024-09-24T00:07:29Z WRN Connection terminated error=“already connected to this server, trying another address” connIndex=3

You need to add these endpoints in your router/firewall by following this article:

Also, your connection issue appears to drop and reconnects which seems normal. Check the state of your tunnel if it says health or degraded. Also ensure your Network CIDR is attached to your tunnel. Restart your tunnel and it should reestablish successfully.

Always keep an eye on this page https://www.cloudflarestatus.com/ for any schedule maintenances

Thank yo for all the great information. It is interesting as I am migrating from a raspberry pi which had no issues behind the router to a docker desktop on a mac. Is there any documentation of a tutorial for mac docker desktop that I missed?

Looks like I need to pass port 7844:7844/udp to get my system working correctly.

1 Like

is it working now