Traefik dashboard only on the http port

♀尐吖头ヾ 提交于 2021-02-10 22:17:28

问题


I am trying to expose my docker services (like Heimdall, Plex, Tautulli, etc) on my host machines IP for internal purposes only, so without a domain name. I want each service to be accessible ith its own prefix like 192.168.0.100/heimdall, 192.168.0.100/tautulli, etc.

I would like to have the dashboard on a separate port, like 8080, but even after I specify an entry point for 8080 as traefik and set traefik as the entry point for the service it still goes to the port 80 named http.

Is there any issue with my config or is it an issue on traefik side?

docker-compose.yml

version: '3'
services:
  traefik:
    image: traefik
    container_name: traefik
    ports:
      - "80:80"
      - "8080:8080"
    restart: always
    volumes:
      - ./traefik:/etc/traefik
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

traefik.yml

entryPoints:
  http:
    address: ":80"
  traefik:
    address: ":8080"
api: {}
log:
  level: "DEBUG"
providers:
  file:
    directory: /etc/traefik/dynamic
  docker:
    endpoint: unix:///var/run/docker.sock
    exposedByDefault: false

dashboard.yml

http:
  routers:
    api:
      rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
      entrypoints:
        - traefik
      service: api@internal

回答1:


According to documentation (https://docs.traefik.io/v2.2/operations/api/#insecure), this could help:

api:
  insecure: true

It should implicitly use special entrypoint traefik with port 8080. You can also check this for more info about dashboard: https://docs.traefik.io/operations/dashboard/

EDIT

I have just tried it and it works on port 8080 with this configuration:

docker-compose.yml

version: '3'

services:
    traefik:
        image: traefik
        container_name: traefik
        restart: always
        ports:
            - "80:80"
            - "8080:8080"
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock:ro"
            - "./dockerfiles/traefik/traefik.yml:/etc/traefik/traefik.yml:ro"
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
            - "traefik.http.routers.dashboard.entrypoints=traefik"
            - "traefik.http.routers.dashboard.service=api@internal"

traefik.yml (I have used yours without file provider):

entryPoints:
  http:
    address: ":80"
  traefik:
    address: ":8080"
api: {}
log:
  level: "DEBUG"
providers:
  docker:
    endpoint: unix:///var/run/docker.sock
    exposedByDefault: false


来源:https://stackoverflow.com/questions/63429913/traefik-dashboard-only-on-the-http-port

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!