How can I ensure Cloudflared automatically restarts within the Docker container if it crashes?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I ensure Cloudflared automatically restarts within the Docker container if it crashes?
Asked by:
94 Viewed 94 Answers
Responsive Ad After Question

Answer (94)

Best Answer
(375)
Use the `--restart` flag with `docker run`. `--restart unless-stopped` is a good option. This tells Docker to automatically restart the container unless it was explicitly stopped. Example: `docker run -d --name cloudflared --restart unless-stopped -p 53:53/udp -p 53:53/tcp -v /path/to/config.yaml:/etc/cloudflared/config.yaml cloudflare/cloudflared tunnel run `