initial-traefik

Initialize and configure Traefik reverse proxy with Docker. Install Traefik, configure Docker Compose, set up service routing via path prefix or host-based routing, enable features like dashboard metrics logging tracing, configure Dashboard access via nip.io or path prefix

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "initial-traefik" with this command: npx skills add le-shi/initial-traefik

Initial Traefik

Initialize and configure Traefik v3 reverse proxy with Docker Compose for service routing and load balancing.

Quick Start

1. Create Configuration

mkdir -p ~/.docker/compose
cd ~/.docker/compose

2. Create docker-compose.yml

Use assets/docker-compose.yml as template. Key configuration:

services:
  traefik:
    image: traefik:v3.0
    container_name: traefik
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik-dynamic.yml:/etc/traefik/dynamic.yml:ro
    command:
      - --api=true
      - --api.dashboard=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --providers.file.directory=/etc/traefik
      - --providers.file.watch=true
      - --entrypoints.web.address=:80
      - --accesslog=true
      - --metrics.prometheus=true

3. Create Dynamic Configuration

Use assets/traefik-dynamic.yml as template for service routing.

4. Start Traefik

docker compose up -d

5. Connect Services to Network

for container in <service-names>; do
  docker network connect compose_default $container
done

Routing Options

Option A: Path Prefix Routing (IP + Path)

Access services via http://<IP>/<service>:

http:
  routers:
    n8n:
      rule: "PathPrefix(`/n8n`)"
      service: n8n
      entryPoints:
        - web
      middlewares:
        - n8n-stripprefix
  
  middlewares:
    n8n-stripprefix:
      stripPrefix:
        prefixes:
          - /n8n
  
  services:
    n8n:
      loadBalancer:
        servers:
          - url: "http://n8n:5678"

Access: http://192.168.9.192/n8n

Option B: Host-Based Routing (.nip.io)

Access services via http://<service>.<IP>.nip.io:

http:
  routers:
    n8n:
      rule: "Host(`n8n.192.168.9.192.nip.io`)"
      service: n8n
      entryPoints:
        - web
  
  services:
    n8n:
      loadBalancer:
        servers:
          - url: "http://n8n:5678"

Access: http://n8n.192.168.9.192.nip.io

Option C: Docker Labels

Configure routing directly in docker-compose.yml labels:

services:
  traefik:
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dashboard.rule=Host(`traefik.192.168.9.192.nip.io`)"
      - "traefik.http.routers.dashboard.service=api@internal"
      - "traefik.http.routers.dashboard.entrypoints=web"

Enable Features

See references/features.md for complete feature list and configuration.

Common Tasks

Add New Service

  1. Connect container to network:

    docker network connect compose_default <container-name>
    
  2. Add router to traefik-dynamic.yml:

    routers:
      myservice:
        rule: "PathPrefix(`/myservice`)"
        service: myservice
        entryPoints:
          - web
        middlewares:
          - myservice-stripprefix
    
    services:
      myservice:
        loadBalancer:
          servers:
            - url: "http://<container-name>:<port>"
    

Traefik auto-reloads configuration.

Check Status

docker logs traefik | grep -E "router|error"
docker exec traefik wget -q -O - http://localhost:8080/api/http/routers

Restart Traefik

docker restart traefik

References

  • Features: See references/features.md for all available features
  • Examples: See references/examples.md for common configurations
  • Templates: See assets/ for configuration templates

Troubleshooting

  • 404 errors: Check container is connected to compose_default network
  • Configuration not loading: Check traefik-dynamic.yml YAML syntax
  • Service not accessible: Verify container name and port in service configuration
  • Dashboard not working: Ensure --api.dashboard=true is in command

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Travel Assistant-CN

AI智能旅游规划助手。当用户需要规划旅行、查询目的地信息、获取出行建议时触发,包括但不限于:制定旅行计划、分析目的地天气、分析景点推荐、规划交通住宿、推荐当地美食、制定行李清单、查询旅行注意事项。触发词:旅游助手、帮我规划旅行、去XX旅行要带什么、XX城市天气如何、推荐XX景点、XX有什么好吃的、旅行建议、自驾游...

Registry SourceRecently Updated
770Profile unavailable
General

project-containerize

对项目进行完整的容器化适配。自动检测分析项目代码和文档,配置和优化代码容器化打包方案,生成专用Dockerfile,生成专用compose.yaml用于快捷部署,输出说明文档,最终生成适配项目的容器化部署方案。触发词:容器化、Docker、docker run、docker-compose、Dockerfile、...

Registry SourceRecently Updated
760Profile unavailable
General

article-link-skill

文章链接提取工具。提交付费媒体文章链接,自动匹配已有内容并返回英文全文,或排队提取。支持 Barron's、Bloomberg、Financial Times、Foreign Policy、Handelsblatt、MarketWatch、New York Times、Reuters、The Atlantic、T...

Registry SourceRecently Updated
780Profile unavailable
General

marcus-investment-analyst

Marcus 投资分析技能 - 基于缠论+MACD+RSI 的 A 股投资策略。用于股票分析、回测、投资建议。触发词:分析股票、回测策略、投资建议、Marcus 策略。

Registry SourceRecently Updated
2860Profile unavailable