Hi,
I have this in my docker-composer.yml
traefik:
container_name: traefik
image: traefik:alpine
restart: always
networks:
- skynet
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Copenhagen
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/klapvogn/docker/data/traefik/config/traefik.toml:/etc/traefik/traefik.toml
- /home/klapvogn/docker/data/traefik/config/acme.json:/acme.json
labels:
- "traefik.http.routers.dashboard.rule=Host(`traefik.domain.tld`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=xxxx:xxxx"
It works when I do : IP:8080/dashboard/
but not when I do : traefik.domain.tld
what have I done wrong?
Share your static config traefik.toml
.
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[api]
dashboard = true
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "domain.tld"
watch = true
exposedbydefault = false
defaultrule = "Host(`{{ index .Labels \"com.docker.compose.service\" }}.domain.tld`)"
[acme]
email = "xxxx"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"
Doesn’t make sense. You have no 8080 entrypoint
and no api.insecure=true
. There should be nothing listening on port 8080.
Check simple Traefik example.
So how do I add 8080 to the entrypoint?
I have added
[api]
dashboard = true
insecure = true
What do you want to achieve? With insecure
an automatic entrypoint on 8080 is created.
You need to use traefik.domain.tld/dashboard/
.
I have now been looking at : simple Traefik example an I have this now:
traefik:
container_name: traefik
image: traefik:alpine
restart: always
networks:
- skynet
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Copenhagen
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/xxx/docker/data/traefik/config/traefik.toml:/etc/traefik/traefik.toml
- /home/xxx/docker/data/traefik/config/acme.json:/acme.json
labels:
- traefik.enable=true
- traefik.http.routers.mydashboard.rule=Host(`whoami.domain.tld`)
- traefik.http.routers.mydashboard.service=api@internal
- traefik.http.routers.mydashboard.middlewares=myauth
- traefik.http.middlewares.myauth.basicauth.users=klapvogn:xxxx
whoami:
image: traefik/whoami:v1.8
networks:
- skynet
labels:
- traefik.enable=true
- traefik.http.routers.mywhoami.rule=Host(`whoami.domain.tld`) || Host(`www.whoami.domain.tld`)
- traefik.http.services.mywhoami.loadbalancer.server.port=80
- traefik.http.middlewares.mywwwredirect.redirectregex.regex=^https://www\.(.*)
- traefik.http.middlewares.mywwwredirect.redirectregex.replacement=https://$${1}
- traefik.http.routers.mywhoami.middlewares=mywwwredirect
So the link you linked does not use traefik.toml
?
Traefik static config can be in traefik.yml/.toml
or in command
.