From caef72861940a7336a7523e464831e44a45b2a91 Mon Sep 17 00:00:00 2001 From: fanfpy Date: Mon, 30 Jun 2025 17:34:02 +0800 Subject: [PATCH] =?UTF-8?q?ci(traefik):=20=E6=B7=BB=E5=8A=A0docker=20provi?= =?UTF-8?q?der=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=8C=82=E8=BD=BDdocker.sock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在traefik配置中添加docker provider并设置exposedByDefault为false,同时在docker-compose中挂载docker.sock以支持容器发现 --- docker-compose.yml | 1 + traefik/traefik.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 859da40..b8b41a0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - "80:80" - "8080:8080" # Traefik dashboard volumes: + - /var/run/docker.sock:/var/run/docker.sock - ./traefik/traefik.yml:/etc/traefik/traefik.yml data-service: diff --git a/traefik/traefik.yml b/traefik/traefik.yml index 83d5232..205a8ab 100644 --- a/traefik/traefik.yml +++ b/traefik/traefik.yml @@ -2,7 +2,11 @@ entryPoints: web: address: ":80" + providers: + docker: + exposedByDefault: false + consulCatalog: endpoint: address: "consul:8500"