LoginSignup
1
0

More than 1 year has passed since last update.

traefikのdashbordを有効にする

Posted at

上記の設定が出来ていることが前提となります。

traefik.yml

dashboard に true を設定します

# Providers config
providers:
  docker: {} # Dockerとの連携を有効

# API/Dashboard config
api:
  insecure: true # WebUI にアクセスできるように設定
+  dashboard: true # dashboard

docker-compose.yml

dashboard の設定を labels に追加します

version: '3.7'

services:
  traefik:
    image: traefik
    container_name: traefik
    restart: "always"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /tmp/traefik.yml:/etc/traefik/traefik.yml:ro
+    labels:
+      - traefik.enable=true
+      - traefik.http.routers.dashboard.service=api@internal
+      - traefik.http.routers.dashboard.rule=Host(`www.localhost`)
+      # HTTPSの設定をする場合
+      - traefik.http.routers.dashboard.entrypoints=secure
+      - traefik.http.routers.dashboard.tls=true
+      - traefik.http.routers.dashboard.tls.certresolver=default

ダッシュボードへのアクセス

https://www.localhost/
上記URLにアクセスをすれば、ダッシュボードにリダイレクトが行われて表示されます。

■関連記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0