• Stars
    star
    136
  • Rank 260,166 (Top 6 %)
  • Language
    Dockerfile
  • License
    Other
  • Created over 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple Alpine-built scratch-runtime Dockerfile for cloudflared, with support for multiple architectures.

Erisa's Cloudflared Docker Image

This repository contains a simple Dockerfile to build cloudflared, the client for Cloudflare Tunnel, from source.

Note
This Docker image is not an official Cloudflare product.

The aim is to support multiple architectures.
The public image currently supports:

Docker target Also known as Notes
linux/amd64 x86_64 Majority of modern PCs and servers.
linux/386 x86 32-bit Intel/AMD CPUs. Typically really old computer hardware. These images are untested.
linux/arm64 aarch64 64-bit ARM hardware. For example Apple Silicon or Raspberry Pi 2/3/4 running a 64-bit OS.
linux/arm/v7 armhf 32-bit ARM hardware. For example most Raspberry Pi models running Raspberry Pi OS.
linux/arm/v6 armel Older 32-bit ARM hardware. Mostly Raspberry Pi 1/0/0W but there may be others. These images are untested.
linux/s390x IBM Z Linux on IBM Z for IBM mainframes, most notably IBM Cloud.
linux/ppc64le ppc64el Tested on IBM Cloud Power Systems Virtual Server

The public image corresponding to this Dockerfile is erisamoe/cloudflared and should work in mostly the same way as the official image.

Note
If you have any problems or questions with this image, either open a GitHub Issue or join the Cloudflare Developers Discord Server and ping @Erisa | Support Engineer in #general-help, #general-discussions or #off-topic with your question.

Cloudflare Tunnel

Warning
Legacy Tunnels are unsupported. You should migrate all existing legacy tunnels to Named Tunnels.

Dashboard setup (Recommended)

A docker-compose example with a Zero Trust dashboard setup would be:

services:
  cloudflared:
    image: erisamoe/cloudflared
    restart: unless-stopped
    command: tunnel run
    environment:
      - TUNNEL_TOKEN=${TUNNEL_TOKEN}
    depends_on:
      - mycontainer

Where an .env file in the same directory contains TUNNEL_TOKEN= set to the token given by the Zero Trust dashboard. For more information see the Cloudflare Blog

Note A previous version of this README recommended using --token ${CLOUDFLARED_TOKEN}, which is a less secure way of handing off the token. Setting the TUNNEL_TOKEN variable seems to be a better way of approaching this.

Config file setup (Named tunnel)

An example for a setup with a local config would be:

services:
  cloudflared:
    image: erisamoe/cloudflared
    restart: unless-stopped
    volumes:
      - ./cloudflared:/etc/cloudflared
    command: tunnel run mytunnel
    depends_on:
      - mycontainer

Where ./cloudflared is a folder containing the .json or .pem credentials and config.yml for a tunnel.

An example config.yml might look like:

tunnel: uuid-for-tunnel
#Optional
#credentials-file: /etc/cloudflared/uuid-for-tunnel.json

ingress:
  - hostname: mywebsite.com
    service: http://nginx:80
  - service: http_status:404

For more information, refer to the Cloudflare Documentation

To acquire a certificate, you'll need to use the login command.
This will spit out /.cloudflared/cert.pem, rather than /etc/cloudflared.

As such, usage would be something like:

docker run -v $PWD/cloudflared:/.cloudflared erisamoe/cloudflared login

to create a folder called cloudflared in your current dir and deposit a cert.pem into it.

To create a tunnel, you can then do:

docker run -v $PWD/cloudflared:/etc/cloudflared erisamoe/cloudflared tunnel create mytunnel

Which gives you a UUID for the new tunnel and and a .json credentials file corresponding to it.

And now you can either use the above compose example or for testing simply just:

docker run -v $PWD/cloudflared:/etc/cloudflared erisamoe/cloudflared --hostname test.example.com --name mytunnel --hello-world

Which will start up a "Hello world" test tunnel on https://test.example.com.

DNS-over-HTTPS

While not the original intent behind the image, you can also use this to host a DNS resolver that speaks to a DNS-over-HTTPS backend.
For example:

docker run -d -p 53:53/udp --name my-dns-forwarder erisamoe/cloudflared proxy-dns

Would create a container called my-dns-forwarder that responds to DNS requests on your host.
Keep in mind when using this on a public server (e.g. VPS) it will by default listen on all interfaces, making you a public DNS resolver on the internet.
You can sidestep this by changing the -p to instead be -p 127.0.0.01:53:53/udp to listen on localhost instead.

You can also add upstreams with --upstream https://dns.example.com for example. By default, Cloudflare DNS is used.

More Repositories

1

RoundedTB

Add margins, rounded corners and segments to your taskbars!
C#
2,385
star
2

discord-oidc-worker

Sign into Discord on Cloudflare Access, powered by Cloudflare Workers!
JavaScript
107
star
3

Cliptok

Moderation Discord bot for Microsoft Community.
C#
57
star
4

worker-links

A simple URL Shortener for Cloudflare Workers!
TypeScript
40
star
5

save-all-tab-urls

Save all the open tabs as a list of URLs to go back to!
CSS
33
star
6

download-image

No save as prompts! Extension to add a context menu item which allows you to directly download an image!
JavaScript
29
star
7

domain-redirect

Easily redirect one entire domain to another with a serverless Cloudflare Worker.
JavaScript
19
star
8

multi-render

Serve multiple R2 buckets from the same Worker, with different settings
TypeScript
19
star
9

erisa.uk

It's a website!
Astro
18
star
10

colour-me

Colour me! is a simple Discord bot running on Cloudflare Workers that allows server admins to give users the ability to change the colour of their own assigned colour roles!
TypeScript
18
star
11

Lykos

Private Discord bot for misc things.
C#
15
star
12

dis.cord.gift

IMPORTANT: This is just a rickroll. There is nothing malicious and never will be. Send any legal requests to my email.
HTML
15
star
13

hetzner-firewall-cfworker

Use Cloudflare Workers Cron Triggers to keep your Hetzner Cloud Firewall allowing the latest list of Cloudflare IPs, or any other lists!
TypeScript
15
star
14

how-many-servers

Find out how many Discord servers you're in.
TypeScript
12
star
15

FrostCleverbot-rb

Super simple Cleverbot inspired by https://github.com/jagrosh/FrostCleverbot
Ruby
11
star
16

Simplepad

A simple Notepad clone for Windows. Supports Unix line endings!
Visual Basic .NET
11
star
17

element.awau.uk

Element on Cloudflare Pages
HTML
10
star
18

redis-exposer

Serve read-only Redis data over a HTTP API with auth
JavaScript
10
star
19

dbots-guild-count

Cloudflare Worker cron to sync Discord bot guild count to discord.bots.gg API
TypeScript
10
star
20

discordsh

Run Shell commands from within Discord! Uses sh on Linux, and CMD on Windows.
Ruby
10
star
21

NaughtyGirlBanner

Simple anti-raid bot for Discord.
Ruby
10
star
22

resizing-worker

Proxy that resizes where requested
JavaScript
8
star
23

EmojiDumper

Ruby script to download all emoji images from all servers you're in.
Ruby
8
star
24

sdxl-worker

Stable Diffusion XL Workers AI demo
TypeScript
8
star
25

simple-r2-form

HTML
8
star
26

new-reddit-redirect

Always use your preferred Reddit design when someone links you to the old Reddit.
JavaScript
6
star
27

awau.uk

nothing to see here
HTML
6
star
28

discord-voice-curfew

Lock and unlock a Discord voice channel at certain times of day
Python
5
star
29

cf-cache-clear-worker-webook

Cloudflare Worker that clears all cache in a given zone when called. Designed to be used as a webhook.
JavaScript
5
star
30

erisa-games-archive

epic gamer
HTML
5
star
31

Discord-DarkPink

Modified colorize theme. For personal use, use it if you want.
4
star
32

RPG-Maker-Scripts

Various scripts and plugins I've created for RPG Maker engines over the years.
Ruby
4
star
33

erisa.dev

giscus discussions
3
star
34

Heartosoft

Based on Naamloos/ModCore, customised for Microsoft Community
C#
3
star
35

nginx-configs

Doesn't include keys for obvious reasons.
3
star
36

DiscordTouchpadBugWorkaround

Hacky workaround for a rare Discord bug when scrolling on a touchpad.
C#
3
star
37

codespaces

Shell
3
star
38

PokeParse

Simple script to convert a Pokemon Essentials pokemon.txt into a database (But not back again :D). Don't ask lol
Ruby
3
star
39

RC24-MailPatch-Portable

A simple, light and portable version of the Mail Patcher for RiiConnect24
Ruby
3
star
40

personal-batch-scripts

Personal batch (.bat) scripts used on Windows.
Batchfile
3
star
41

seafile-gateway

welcome to the edge.
HTML
2
star
42

testgithubpages

shh ignore this
HTML
2
star
43

mee6-to-cliptok

MEE6 to Cliptok infraction/warning migration
Ruby
2
star
44

mraow.party

A Cloudflare Worker serving a single HTML file for the mraow.party root page.
HTML
2
star
45

docs.erisa.uk

Erisa documentation
JavaScript
2
star
46

Cliptok-aprilfools2022

C#
2
star
47

erisa.network

CSS
1
star
48

.github

1
star
49

webuy-stock-alerts

Monitor CeX WeBuy Stock and get notified when something is in stock
JavaScript
1
star
50

whoisapi

Dockerfile
1
star
51

serverauction-ng

WIP Discord bot for interacting with Hetzner Server Auction
Ruby
1
star
52

erisa.github.io

literally just a redirect. nothing special
1
star
53

colour-me-site

Website for Colour Me!
CSS
1
star
54

kernel_samsung_sm-a405fn

Android kernel for Samsung A40, with some additional features (Wireguard, exFAT..)
C
1
star
55

wrangler-testing

testing wrangler-action
HTML
1
star