Deploy Traefik with Docker and Access It Remotely via cpolar
This guide shows how to install Traefik as a Docker container, configure its dashboard, install the cpolar tunneling tool on Linux, and create both temporary and permanent public URLs so you can manage Traefik remotely without buying a cloud server.
Introduction
Traefik is a cloud‑native HTTP reverse proxy and load balancer that can be easily deployed for micro‑service environments. It supports many back‑ends (Docker, Swarm, Consul, etc.) and offers dynamic configuration through a built‑in web UI.
1. Deploy Traefik with Docker
Create a docker-compose.yml file in any directory with the following content:
version: "3"
services:
traefik:
image: traefik:v3.0.0-beta3
ports:
- 8080:8080
command: "--api=true --api.dashboard=true --api.insecure=true"The command enables the API, dashboard, and insecure access on port 8080. After saving the file, run: docker compose up If the process stops, press Ctrl+C, find the container ID with docker ps -a, and restart it using docker start <container_id>. Verify the container is running with docker ps.
2. Test Local Access to the Traefik Dashboard
Once the container is up, open a browser on any device in the same LAN and navigate to http://<linux_host_ip>:8080. The Traefik dashboard should be visible.
3. Install cpolar on Linux
cpolar provides an easy way to expose local ports to the public internet without purchasing a domain or cloud server.
Official site: https://www.cpolar.com
Install with the one‑click script:
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bashAdd the service to systemd: sudo systemctl enable cpolar Start the cpolar service: sudo systemctl start cpolar After installation, log in to the cpolar web UI (access http://<linux_ip>:9200) and you will see the management interface.
4. Configure a Public cpolar Tunnel for Traefik
In the cpolar dashboard, go to Tunnel Management → Create Tunnel and fill in:
Tunnel name: any unique name
Protocol: http Local address: 8080 (Traefik dashboard port)
Domain type: Random free domain Region: China Click Create. The tunnel list will show both HTTP and HTTPS public URLs.
5. Access Traefik Remotely
Open any browser on any device and navigate to the public HTTPS URL generated by cpolar. The Traefik dashboard will be reachable from the internet, allowing remote management without a dedicated server.
6. Set a Fixed Public Address
Random tunnels change every 24 hours, which is inconvenient for long‑term use. Upgrade cpolar to at least the Basic plan, reserve a sub‑domain, and configure the tunnel to use this fixed sub‑domain.
In cpolar UI, go to Reserve and choose Sub‑domain.
Enter the desired sub‑domain name and confirm.
Return to Tunnel Management → Tunnel List , edit the previously created tunnel, and set Domain type to Sub‑domain and Sub Domain to the reserved name.
Click Update (once is enough).
The tunnel list now shows the fixed public URL. Use this URL to access the Traefik dashboard anytime, providing a permanent remote entry point.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
