Cloudflared docker container with web UI

Have a simple question about creating a tunnel using the Cloudflare web UI. When I create a new tunnel there is a docker run command that is generated with a token, like this:

docker run Cloudflare/cloudflared:2022.5.1 tunnel --no-autoupdate run --token [long token]

After I run it, the tunnel is established as expected. But what is the long term way of running the cloudflared container? Do people just add the -d flag to the run the docker container in the background? What about other docker options such as restart policy? Is there a docker-compose example?

It all depends on what your environment looks like for the best way to run your tunnel. If you are using it with other containers, then you can look at docker-compose. If you are running it by itself, then you want both a restart policy and the -d option.

As for a docker-compose example. Here is one I just for running xyzzy

version: "3.7"

services:

  pyx:
    image: ghcr.io/cyb3r-jak3/dockeryourxyzzy:on-demand
    ports:
     - "8080:8080"
    networks:
      - pyx-net
    environment:
      - TOMCAT_USER=tomcat_user
      - TOMCAT_PASSWORD=tomcat_password
      - DB_NAME=pyx
      - DB_USER=pyx
      - DB_PASSWORD=CorrectHorseBatteryStaple

  postgres:
    image: "postgres:alpine"
    volumes:
      - ./data/pgdata:/var/lib/postgresql/data
    networks:
      - pyx-net
    environment:
      - POSTGRES_DB=pyx
      - POSTGRES_USER=pyx
      - POSTGRES_PASSWORD=CorrectHorseBatteryStaple

  cloudflared:
      image: cloudflare/cloudflared:2022.5.1
      user: root
      command: tunnel run --token <token>

      networks:
      - pyx-net

networks:
  pyx-net:

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