Cloudflare tunnel and docker compose

In this thread

@Erisa kindly has the compose file needed for running a cloudflare tunnel in docker compose. Aplogies for the noob question but how was the environment part determined ie. “TUNNEL_TOKEN” specifically.

The docker run command is tunnel run --token=…

just curious as to how that translates to the compose file’s “TUNNEL_TOKEN”

thanks!

Hey!

The TUNNEL_TOKEN environment variable is functionally the same as the --token parameter, and is documented here: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#token

It’s generally preferred since the token is not exposed as part of the running commandline which is accessible to any other user on the machine. The environment variable implies an extra layer of secrecy.

In a docker run command you would do something like -e TUNNEL_TOKEN=mytokenwhatever, I’m not entirely sure why the dashboard example uses --token.

If you wanted you could take this the extra mile by making it a Docker secret:

1 Like

thank you so much! Searched so much for those docs and couldn’t find them.

Appreciate it!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.