【重要】traefik 配置

This commit is contained in:
编码猿
2025-09-30 10:01:58 +08:00
parent a3ba6c2944
commit 3c66faf9a7
3 changed files with 120 additions and 75 deletions

View File

@@ -2,7 +2,7 @@ version: '3.8'
services:
traefik:
image: traefik:v3.0
image: traefik:latest
container_name: traefik
networks:
- traefik-net
@@ -10,30 +10,18 @@ services:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.yml:/etc/traefik/traefik.yml
- ./dynamic.yml:/etc/traefik/dynamic.yml # 动态配置文件
- ./dynamic.yml:/etc/traefik/dynamic.yml
- ./log-file.log:/etc/traefik/log-file.log
- ./access.log:/etc/traefik/access.log
restart: always
whoami:
image: traefik/whoami
image: traefik/whoami:latest
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
# 2. Nacos 服务监听脚本
# nacos-cluster-watcher:
# user: "root"
# privileged: true
# image: node:24.8.0-alpine3.21
# container_name: nacos-cluster-watcher
# # network_mode: "host"
# networks:
# - traefik-net
# working_dir: /app
# volumes:
# - ./:/app # 挂载当前目录到容器
# command: sh -c "npm install && node src/index.js"
# restart: always
networks:
traefik-net:
driver: bridge