For a Docker container running `cloudflared`, how would I provide the authentication credentials without browser interaction?

Responsive Ad Header

Question

Grade: Education Subject: Support
For a Docker container running `cloudflared`, how would I provide the authentication credentials without browser interaction?
Asked by:
125 Viewed 125 Answers
Responsive Ad After Question

Answer (125)

Best Answer
(704)
For a Docker container, the most common and secure way to provide headless authentication is by passing the Cloudflare Tunnel Service Token as an environment variable to the container. Example: ```bash docker run -d --name cloudflared_tunnel \ -e TUNNEL_TOKEN="YOUR_SERVICE_TOKEN_HERE" \ cloudflare/cloudflared:latest tunnel run ``` Alternatively, you can bind-mount a local `config.yml` file containing the `tunnel_token` into the container: ```bash docker run -d --name cloudflared_tunnel \ -v /path/to/local/config.yml:/etc/cloudflared/config.yml \ cloudflare/cloudflared:latest tunnel run ``` Ensure the mounted `config.yml` specifies the `tunnel_token`.