Quick Guide: Cloudflare Tunnels

Quick Guide: Cloudflare Tunnels
Photo by Antonino Visalli / Unsplash

Creating Cloudflare Tunnels.

Once it provides me with the connector code that I need to execute in a terminal, I have found that these are assigned random names, but with the help of ChatGPT you can add a couple of additions to name them. This makes it far easier to manage if you have multiple of these and use a UI like Portainer (which I absolutely do).

Before:

sudo docker run cloudflare/cloudflared:latest tunnel --no-autoupdate run --token .. .. ..

Which, with a couple of modifications, will then look like:

sudo docker run -d --restart unless-stopped --name tunnel_name cloudflare/cloudflared:latest tunnel --no-autoupdate run --token .. .. ..

The differences are:

-d: Runs the container in detached mode (in the background)

--restart unless-stopped: Is a "Restart Policy" which ensures that the Tunnel/Container will run unless you manually stop it.

--name tunnel_name: Gives your container the name "tunnel_name"