spb722
March 27, 2022, 4:27pm
1
the docker compose file
version: '3'
services:
traefik:
image: 'traefik:v2.2'
ports:
- '80:80'
- '443:443'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- '$PWD/services/traefik/traefik.prod.toml:/etc/traefik/traefik.toml'
labels:
- traefik.enable=true
- traefik.http.routers.dashboard.rule = "Host(`monitor.sachinpb.xyz`)"
- traefik.http.routers.dashboard.service = "api@internal"
- traefik.http.routers.dashboard.entrypoints = "internal"
- traefik.http.routers.dashboard.tls=true
- traefik.http.routers.dashboard.tls.certresolver=letsencrypt
web:
image: springboot-docker-container
expose:
- 8080
build:
context: ./
dockerfile: Dockerfile
volumes:
- '/home/ubuntu/scard/properties:/config'
environment:
- 'CONFIG_LOCATION=file:/config/application.properties'
labels:
- traefik.enable=true
- traefik.http.routers.fastapi.rule=Host(`sachinpb.xyz`)
- traefik.http.routers.fastapi.tls=true
- traefik.http.routers.fastapi.tls.certresolver=letsencrypt
the traekfik toml file
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[accessLog]
[api]
# Dashboard
#
# Optional
# Default: true
#
dashboard = true
#insecure = true
[providers]
[providers.docker]
exposedByDefault = true
[certificatesResolvers.letsencrypt.acme]
email = "spb722@gmail.com"
storage= "acme.json"
[certificatesResolvers.letsencrypt.acme.httpChallenge]
entryPoint = "web"
the web is working fine with ssl
Hello @spb722 ,
I think your error comes from this. Does the internal
entrypoint exists ?
Either way, here's a simple example where the dashboard is accessible on traefik.localhost
:
version: '3.9'
services:
traefik:
image: traefik:v2.7
command:
- --api.dashboard=true
- --providers.docker
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
traefik.http.routers.traefik.rule: Host(`traefik.localhost`)
traefik.http.routers.traefik.service: api@internal
spb722
March 28, 2022, 9:41am
3
i made the required changes
version: '3'
services:
traefik:
image: 'traefik:v2.2'
ports:
- '80:80'
- '443:443'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- '$PWD/services/traefik/traefik.prod.toml:/etc/traefik/traefik.toml'
command:
- --api.dashboard=true
- --providers.docker
labels:
- traefik.http.routers.traefik.rule = Host(`monitor.sachinpb.xyz`)
- traefik.http.routers.traefik.service = api@internal
web:
image: springboot-docker-container
expose:
- 8080
build:
context: ./
dockerfile: Dockerfile
volumes:
- '/home/ubuntu/scard/properties:/config'
environment:
- 'CONFIG_LOCATION=file:/config/application.properties'
labels:
- traefik.enable=true
- traefik.http.routers.fastapi.rule=Host(`sachinpb.xyz`)
- traefik.http.routers.fastapi.tls=true
- traefik.http.routers.fastapi.tls.certresolver=letsencrypt
but in logs its showing
scard-traefik-1 | time="2022-03-28T09:39:44Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.toml"
scard-traefik-1 | time="2022-03-28T09:39:44Z" level=error msg="field not found, node: rule " providerName=docker container=traefik-scard-30004bd437068ecd5ebba5c45064d763015308af1576e9356c9c161873ac2b38
Can you try with the latest version (v2.6
) of Traefik ?
cakiwi
March 28, 2022, 12:06pm
5
This is simply due to the spaces you're introduced in the label on these lines:
- traefik.http.routers.dashboard.rule = "Host(`monitor.sachinpb.xyz`)"
- traefik.http.routers.dashboard.service = "api@internal"
- traefik.http.routers.dashboard.entrypoints = "internal"
1 Like
spb722
March 28, 2022, 1:31pm
6
tried with V 2.6 same issue
scard-traefik-1 | time="2022-03-28T13:30:01Z" level=error msg="field not found, node: rule " providerName=docker container=traefik-scard-766dbebb3520e5cc0c7c0040acd55baa33d27aadaa38662e7136906da01e568c