Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers.docker.defaultrule #10509

Closed
2 tasks done
WPF0414 opened this issue Mar 10, 2024 · 4 comments
Closed
2 tasks done

providers.docker.defaultrule #10509

WPF0414 opened this issue Mar 10, 2024 · 4 comments

Comments

@WPF0414
Copy link

WPF0414 commented Mar 10, 2024

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

1.unraid install traefik
2.add the traefik.yml and fileconfig.traefik
3.update the providers.docker.defaultrule

  docker:
    watch: true
    network: traefik
    defaultrule: Host(`{{ .ContainerName }}.xxxx.com`)
    endpoint: unix:///var/run/docker.sock

What did you see instead?

If the defaultrule (defaultrule: Host({{ .ContainerName }}.xxxx.com)) is set, the startup prompts {"level":"error","msg":"Error occurred during watcher callback: /etc/traefik/traefik.yml: template: :68:26: executing "" at \u003c.ContainerName\u003e: can't evaluate field ContainerName in type bool","providerName":"file","time":"2024-03-10T01:10:38-08:00"}, and the proxy is correct for ContainerName+domain but the configuration in fileconfig does not take effect. If the defaultrule (defaultrule: Host({{ .ContainerName }}.xxxx.com)) is removed, fileconfig becomes effective, and the proxy container becomes the container name.

image

config is not in effect at this time
This is what I want when I enter the container's delete defaultrule: Host('{{. ContainerName }}. xxxx. com ")

image But when I restarted, he was wrong again. image

What version of Traefik are you using?

v2.11.0

What is your environment & configuration?

global:
  checkNewVersion: true
  sendAnonymousUsage: true

entryPoints:
  http:
    address: :80
    http:
      redirections:
        entrypoint:
          to: https
          scheme: https
  https:
    address: :443
    http:
      tls:
        options: default
        certresolver: cloudflare
        domains:
          - main: xxxx.com
            sans:
              - '*.xxxxx.com'
    forwardedHeaders:
      trustedIPs:
        - 127.0.0.1/32
        - 10.0.0.0/8
        - 192.168.0.0/16
        - 172.16.0.0/12
        - 173.245.48.0/20
        - 103.21.244.0/22
        - 103.22.200.0/22
        - 103.31.4.0/22
        - 141.101.64.0/18
        - 108.162.192.0/18
        - 190.93.240.0/20
        - 188.114.96.0/20
        - 197.234.240.0/22
        - 198.41.128.0/17
        - 162.158.0.0/15
        - 104.16.0.0/13
        - 104.24.0.0/14
        - 172.64.0.0/13
        - 131.0.72.0/22
        - 2400:cb00::/32
        - 2606:4700::/32
        - 2803:f800::/32
        - 2405:b500::/32
        - 2405:8100::/32
        - 2a06:98c0::/29
        - 2c0f:f248::/32

api:
  dashboard: true

log:
  level: DEBUG
  filePath: /logs/traefik.log
  format: json
accessLog:
  filePath: /logs/access.log
  format: json
providers:
  providersThrottleDuration: 2s
  docker:
    watch: true
    network: traefik
    defaultrule: Host(`{{ .ContainerName }}.xxxx.com`)
    endpoint: unix:///var/run/docker.sock
  file:
    watch: true
    directory: /etc/traefik
certificatesResolvers:
  letsencrypt:
    acme:
      email: xxxxxx
      storage: /acme/acme.json
      dnsChallenge:
        provider: cloudflare
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"
# this is fileconfig
http:
  middlewares:
    authelia-basic:
      forwardauth:
        address: http://192.168.123.4:9091/api/verify?auth=basic
        trustForwardHeader: true
        authResponseHeaders:
          - Remote-User
          - Remote-Groups
          - Remote-Name
          - Remote-Email
    authelia:
      forwardAuth:
        address: http://192.168.123.4:9091/api/verify?rd=https://authelia.xxxx.com:443
        trustForwardHeader: true
        authResponseHeaders:
          - Remote-User
          - Remote-Groups
    chain-no-auth:
      chain:
        middlewares: []

  serversTransports:
    pve:
      insecureSkipVerify: true

  routers:

    ikuai:
      entryPoints:
        - https
      rule: Host(`ikuai.xxxx.com`)
      service: ikuai
      middlewares:
        - authelia
      tls:
       certresolver: cloudflare
    pve:
      entryPoints:
        - https
      rule: Host(`pve.xxxx.com`)
      service: pve
      middlewares:
        - chain-no-auth
      tls:
       certresolver: cloudflare
  services:
    ikuai:
      loadBalancer:
        passHostHeader: true
        servers:
          - url: http://192.168.123.1:80
    pve:
      loadBalancer:
        passHostHeader: true
        serversTransport: pve
        servers:
          - url: https://192.168.123.2:8006
tls:
  options:
    default:
      minVersion: VersionTLS12
      cipherSuites:
        - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
        - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
        - TLS_AES_128_GCM_SHA256
        - TLS_AES_256_GCM_SHA384
        - TLS_CHACHA20_POLY1305_SHA256
        - TLS_FALLBACK_SCSV
      curvePreferences:
        - CurveP521
        - CurveP384
      sniStrict: true

Add more configuration information here.

docker run
  -d
  --name='traefik'
  --net='traefik'
  --ip='172.18.0.2'
  -e TZ="America/Los_Angeles"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="5700G"
  -e HOST_CONTAINERNAME="traefik"
  -e 'CF_DNS_API_TOKEN'='xxxxxxxxx'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:8080]/'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/ibracorp/unraid-templates/master/icons/traefik.png'
  -l 'traefik.http.routers.api.rule'='Host(`traefik.xxxx.com`)'
  -l 'traefik.http.routers.api.entryPoints'='https'
  -l 'traefik.http.routers.api.service'='api@internal'
  -l 'traefik.enable'='true'
  -l 'traefik.enable'='true'
  -p '7443:443/tcp'
  -p '7080:80/tcp'
  -p '8000:8080/tcp'
  -v '/mnt/user/appdata/traefik':'/etc/traefik':'rw'
  -v '/var/run/docker.sock':'/var/run/docker.sock':'rw'
  -v '/mnt/user/appdata/traefik/logs':'/logs':'rw' 'traefik:v2.11.0'

If applicable, please paste the log output in DEBUG level

{"level":"info","msg":"I have to go...","time":"2024-03-10T01:30:24-08:00"}
{"level":"info","msg":"Stopping server gracefully","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"https","level":"debug","msg":"Waiting 10s seconds before killing connections.","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"http","level":"debug","msg":"Waiting 10s seconds before killing connections.","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"https","level":"error","msg":"accept tcp [::]:443: use of closed network connection","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"http","level":"error","msg":"accept tcp [::]:80: use of closed network connection","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"http","level":"error","msg":"close tcp [::]:80: use of closed network connection","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"http","level":"debug","msg":"Entry point http closed","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"https","level":"error","msg":"close tcp [::]:443: use of closed network connection","time":"2024-03-10T01:30:24-08:00"}
{"entryPointName":"https","level":"debug","msg":"Entry point https closed","time":"2024-03-10T01:30:25-08:00"}
{"level":"info","msg":"Server stopped","time":"2024-03-10T01:30:25-08:00"}
{"level":"info","msg":"Shutting down","time":"2024-03-10T01:30:25-08:00"}
{"level":"info","msg":"Traefik version 2.11.0 built on 2024-02-12T15:26:45Z","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Static configuration loaded {\"global\":{\"checkNewVersion\":true,\"sendAnonymousUsage\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"http\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":\"10s\"},\"respondingTimeouts\":{\"idleTimeout\":\"3m0s\"}},\"forwardedHeaders\":{},\"http\":{\"redirections\":{\"entryPoint\":{\"to\":\"https\",\"scheme\":\"https\",\"permanent\":true,\"priority\":2147483646}}},\"http2\":{\"maxConcurrentStreams\":250},\"udp\":{\"timeout\":\"3s\"}},\"https\":{\"address\":\":443\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":\"10s\"},\"respondingTimeouts\":{\"idleTimeout\":\"3m0s\"}},\"forwardedHeaders\":{\"trustedIPs\":[\"127.0.0.1/32\",\"10.0.0.0/8\",\"192.168.0.0/16\",\"172.16.0.0/12\",\"173.245.48.0/20\",\"103.21.244.0/22\",\"103.22.200.0/22\",\"103.31.4.0/22\",\"141.101.64.0/18\",\"108.162.192.0/18\",\"190.93.240.0/20\",\"188.114.96.0/20\",\"197.234.240.0/22\",\"198.41.128.0/17\",\"162.158.0.0/15\",\"104.16.0.0/13\",\"104.24.0.0/14\",\"172.64.0.0/13\",\"131.0.72.0/22\",\"2400:cb00::/32\",\"2606:4700::/32\",\"2803:f800::/32\",\"2405:b500::/32\",\"2405:8100::/32\",\"2a06:98c0::/29\",\"2c0f:f248::/32\"]},\"http\":{\"tls\":{\"options\":\"default\",\"certResolver\":\"cloudflare\",\"domains\":[{\"main\":\"xxxxxx.com\",\"sans\":[\"*.xxxxxx.com\"]}]}},\"http2\":{\"maxConcurrentStreams\":250},\"udp\":{\"timeout\":\"3s\"}}},\"providers\":{\"providersThrottleDuration\":\"2s\",\"docker\":{\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ .ContainerName }}.xxxxxx.com`)\",\"exposedByDefault\":true,\"network\":\"traefik\",\"swarmModeRefreshSeconds\":\"15s\"},\"file\":{\"directory\":\"/etc/traefik\",\"watch\":true}},\"api\":{\"dashboard\":true},\"log\":{\"level\":\"DEBUG\",\"filePath\":\"/logs/traefik.log\",\"format\":\"json\"},\"accessLog\":{\"filePath\":\"/logs/access.log\",\"format\":\"json\",\"filters\":{},\"fields\":{\"defaultMode\":\"keep\",\"headers\":{\"defaultMode\":\"drop\"}}},\"certificatesResolvers\":{\"cloudflare\":{\"acme\":{\"email\":\"xxxxxxxx.com\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/etc/traefik/acme.json\",\"keyType\":\"RSA4096\",\"certificatesDuration\":2160,\"dnsChallenge\":{\"provider\":\"cloudflare\",\"resolvers\":[\"1.1.1.1:53\",\"1.0.0.1:53\"]}}}}}","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Stats collection is enabled.","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration.","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Help us improve Traefik by leaving this feature on :)","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"More details on: https://doc.traefik.io/traefik/contributing/data-collection/","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider aggregator aggregator.ProviderAggregator","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","msg":"Starting TCP Server","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider *file.Provider","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"*file.Provider provider configuration: {\"directory\":\"/etc/traefik\",\"watch\":true}","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Starting TCP Server","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"add watcher on: /etc/traefik","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"add watcher on: /etc/traefik/acme.json","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"add watcher on: /etc/traefik/fileconfig.yml","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"add watcher on: /etc/traefik/traefik.yml","time":"2024-03-10T01:30:27-08:00"}
{"level":"error","msg":"Error while building configuration (for the first time): /etc/traefik/traefik.yml: template: :68:26: executing \"\" at \u003c.ContainerName\u003e: can't evaluate field ContainerName in type bool","providerName":"file","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider *traefik.Provider","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"*traefik.Provider provider configuration: {}","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider *acme.ChallengeTLSALPN","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"*acme.ChallengeTLSALPN provider configuration: {}","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider *acme.Provider","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"*acme.Provider provider configuration: {\"email\":\"xxxxxxx@163.com\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/etc/traefik/acme.json\",\"keyType\":\"RSA4096\",\"certificatesDuration\":2160,\"dnsChallenge\":{\"provider\":\"cloudflare\",\"resolvers\":[\"1.1.1.1:53\",\"1.0.0.1:53\"]},\"ResolverName\":\"cloudflare\",\"store\":{},\"TLSChallengeProvider\":{},\"HTTPChallengeProvider\":{}}","time":"2024-03-10T01:30:27-08:00"}
{"ACME CA":"https://acme-v02.api.letsencrypt.org/directory","level":"debug","msg":"Attempt to renew certificates \"720h0m0s\" before expiry and check every \"24h0m0s\"","providerName":"cloudflare.acme","time":"2024-03-10T01:30:27-08:00"}
{"ACME CA":"https://acme-v02.api.letsencrypt.org/directory","level":"info","msg":"Testing certificate renew...","providerName":"cloudflare.acme","time":"2024-03-10T01:30:27-08:00"}
{"level":"info","msg":"Starting provider *docker.Provider","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"*docker.Provider provider configuration: {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ .ContainerName }}.xxxxxx.com`)\",\"exposedByDefault\":true,\"network\":\"traefik\",\"swarmModeRefreshSeconds\":\"15s\"}","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Configuration received: {\"http\":{\"routers\":{\"http-to-https\":{\"entryPoints\":[\"http\"],\"middlewares\":[\"redirect-http-to-https\"],\"service\":\"noop@internal\",\"rule\":\"HostRegexp(`{host:.+}`)\",\"priority\":2147483646}},\"services\":{\"api\":{},\"dashboard\":{},\"noop\":{}},\"middlewares\":{\"redirect-http-to-https\":{\"redirectScheme\":{\"scheme\":\"https\",\"port\":\"443\",\"permanent\":true}}},\"models\":{\"https\":{\"tls\":{\"options\":\"default\",\"certResolver\":\"cloudflare\",\"domains\":[{\"main\":\"xxxxxx.com\",\"sans\":[\"*.xxxxxx.com\"]}]}}},\"serversTransports\":{\"default\":{\"maxIdleConnsPerHost\":200}}},\"tcp\":{},\"udp\":{},\"tls\":{}}","providerName":"internal","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Configuration received: {\"http\":{},\"tcp\":{},\"udp\":{},\"tls\":{}}","providerName":"cloudflare.acme","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Provider connection established with docker 24.0.9 (API 1.43)","providerName":"docker","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Configuration received: {\"http\":{\"routers\":{\"bark\":{\"entryPoints\":[\"https\"],\"service\":\"bark\",\"rule\":\"Host(`bark.xxxxxx.com`)\",\"tls\":{}},\"cookiecloud\":{\"entryPoints\":[\"https\"],\"service\":\"CookieCloud\",\"rule\":\"Host(`CookieCloud.xxxxxx.com`)\",\"tls\":{}}},\"services\":{\"CookieCloud\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.18.0.4:8088\"}],\"passHostHeader\":true}},\"bark\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.18.0.3:8080\"}],\"passHostHeader\":true}}}},\"tcp\":{},\"udp\":{}}","providerName":"docker","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Provider event received {Status:start ID:a38a89eb8dfd22772454c904a5c6a886078bc25f72b91cb9f9ad35586fd86020 From:traefik:v2.11.0 Type:container Action:start Actor:{ID:a38a89eb8dfd22772454c904a5c6a886078bc25f72b91cb9f9ad35586fd86020 Attributes:map[image:traefik:v2.11.0 name:traefik net.unraid.docker.icon:https://raw.githubusercontent.com/ibracorp/unraid-templates/master/icons/traefik.png net.unraid.docker.managed:dockerman net.unraid.docker.webui:http://[IP]:[PORT:8080]/ org.opencontainers.image.description:A modern reverse-proxy org.opencontainers.image.documentation:https://docs.traefik.io org.opencontainers.image.source:https://github.com/traefik/traefik org.opencontainers.image.title:Traefik org.opencontainers.image.url:https://traefik.io org.opencontainers.image.vendor:Traefik Labs org.opencontainers.image.version:v2.11.0 traefik.enable:true traefik.http.routers.api.entryPoints:https traefik.http.routers.api.rule:Host(`traefik.xxxxxx.com`) traefik.http.routers.api.service:api@internal]} Scope:local Time:1710063027 TimeNano:1710063027629943443}","providerName":"docker","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"No default certificate, fallback to the internal generated certificate","time":"2024-03-10T01:30:27-08:00","tlsStoreName":"default"}
{"entryPointName":"http","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware noop@internal","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Creating middleware","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Setting up redirection to https 443","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"traefik-internal-recovery","middlewareType":"Recovery","msg":"Creating middleware","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Adding certificate for domain(s) *.xxxxxx.com,xxxxxx.com","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"No default certificate, fallback to the internal generated certificate","time":"2024-03-10T01:30:27-08:00","tlsStoreName":"default"}
{"entryPointName":"http","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware noop@internal","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Creating middleware","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Setting up redirection to https 443","routerName":"http-to-https@internal","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"traefik-internal-recovery","middlewareType":"Recovery","msg":"Creating middleware","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"pipelining","middlewareType":"Pipelining","msg":"Creating middleware","routerName":"cookiecloud@docker","serviceName":"CookieCloud","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating load-balancer","routerName":"cookiecloud@docker","serviceName":"CookieCloud","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating server 0 http://172.18.0.4:8088","routerName":"cookiecloud@docker","serverName":0,"serviceName":"CookieCloud","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"child http://172.18.0.4:8088 now UP","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Propagating new UP status","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware CookieCloud","routerName":"cookiecloud@docker","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"pipelining","middlewareType":"Pipelining","msg":"Creating middleware","routerName":"bark@docker","serviceName":"bark","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating load-balancer","routerName":"bark@docker","serviceName":"bark","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating server 0 http://172.18.0.3:8080","routerName":"bark@docker","serverName":0,"serviceName":"bark","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"child http://172.18.0.3:8080 now UP","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Propagating new UP status","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware bark","routerName":"bark@docker","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"traefik-internal-recovery","middlewareType":"Recovery","msg":"Creating middleware","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Adding route for cookiecloud.xxxxxx.com with TLS options default","time":"2024-03-10T01:30:27-08:00"}
{"entryPointName":"https","level":"debug","msg":"Adding route for bark.xxxxxx.com with TLS options default","time":"2024-03-10T01:30:27-08:00"}
{"level":"debug","msg":"Configuration received: {\"http\":{\"routers\":{\"api\":{\"entryPoints\":[\"https\"],\"service\":\"api@internal\",\"rule\":\"Host(`traefik.xxxxxx.com`)\"},\"bark\":{\"entryPoints\":[\"https\"],\"service\":\"bark\",\"rule\":\"Host(`bark.xxxxxx.com`)\",\"tls\":{}},\"cookiecloud\":{\"entryPoints\":[\"https\"],\"service\":\"CookieCloud\",\"rule\":\"Host(`CookieCloud.xxxxxx.com`)\",\"tls\":{}}},\"services\":{\"CookieCloud\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.18.0.4:8088\"}],\"passHostHeader\":true}},\"bark\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.18.0.3:8080\"}],\"passHostHeader\":true}},\"traefik\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.18.0.2:80\"}],\"passHostHeader\":true}}}},\"tcp\":{},\"udp\":{}}","providerName":"docker","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"Adding certificate for domain(s) *.xxxxxx.com,xxxxxx.com","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"No default certificate, fallback to the internal generated certificate","time":"2024-03-10T01:30:29-08:00","tlsStoreName":"default"}
{"entryPointName":"http","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware noop@internal","routerName":"http-to-https@internal","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Creating middleware","routerName":"http-to-https@internal","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"redirect-http-to-https@internal","middlewareType":"RedirectScheme","msg":"Setting up redirection to https 443","routerName":"http-to-https@internal","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"http","level":"debug","middlewareName":"traefik-internal-recovery","middlewareType":"Recovery","msg":"Creating middleware","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"pipelining","middlewareType":"Pipelining","msg":"Creating middleware","routerName":"bark@docker","serviceName":"bark","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating load-balancer","routerName":"bark@docker","serviceName":"bark","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating server 0 http://172.18.0.3:8080","routerName":"bark@docker","serverName":0,"serviceName":"bark","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"child http://172.18.0.3:8080 now UP","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"Propagating new UP status","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware bark","routerName":"bark@docker","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware api@internal","routerName":"api@docker","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"pipelining","middlewareType":"Pipelining","msg":"Creating middleware","routerName":"cookiecloud@docker","serviceName":"CookieCloud","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating load-balancer","routerName":"cookiecloud@docker","serviceName":"CookieCloud","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Creating server 0 http://172.18.0.4:8088","routerName":"cookiecloud@docker","serverName":0,"serviceName":"CookieCloud","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"child http://172.18.0.4:8088 now UP","time":"2024-03-10T01:30:29-08:00"}
{"level":"debug","msg":"Propagating new UP status","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"tracing","middlewareType":"TracingForwarder","msg":"Added outgoing tracing middleware CookieCloud","routerName":"cookiecloud@docker","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","middlewareName":"traefik-internal-recovery","middlewareType":"Recovery","msg":"Creating middleware","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Adding route for bark.xxxxxx.com with TLS options default","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Adding route for traefik.xxxxxx.com with TLS options default","time":"2024-03-10T01:30:29-08:00"}
{"entryPointName":"https","level":"debug","msg":"Adding route for cookiecloud.xxxxxx.com with TLS options default","time":"2024-03-10T01:30:29-08:00"}
{"ACME CA":"https://acme-v02.api.letsencrypt.org/directory","level":"debug","msg":"Looking for provided certificate(s) to validate [\"xxxxxx.com\" \"*.xxxxxx.com\"]...","providerName":"cloudflare.acme","time":"2024-03-10T01:30:29-08:00"}
{"ACME CA":"https://acme-v02.api.letsencrypt.org/directory","level":"debug","msg":"No ACME certificate generation required for domains [\"xxxxxx.com\" \"*.xxxxxx.com\"].","providerName":"cloudflare.acme","time":"2024-03-10T01:30:29-08:00"}
@lbenguigui lbenguigui self-assigned this Mar 11, 2024
@lbenguigui lbenguigui added kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. and removed status/0-needs-triage labels Mar 11, 2024
@lbenguigui
Copy link
Contributor

Hello @WPF0414 ,

Thanks for your interest in Traefik.

The error you've encountered is due to the file provider interpreting {{.ContainerName}} as a Go template and attempting to populate it.
I recommend splitting your static and dynamic configurations into dedicated files, this should resolve the issue you're facing.

Feel free to leave a new comment if you continue to experience any issues.

@lbenguigui lbenguigui added contributor/waiting-for-feedback area/provider and removed kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. labels Mar 11, 2024
@WPF0414
Copy link
Author

WPF0414 commented Mar 11, 2024

@lbenguigui thanks!How do I deal with it? I'm currently using lable:traefik. http. routers. xxx. Rule is processed in the form of providers. Docker. defaultrule deleted, but I could have used it in the command in docker-compose before.

@lbenguigui
Copy link
Contributor

Hello @WPF0414 ,

If you want to split static & dynamic configuration that coming from your file provider, I suggest you to replace :

...
providers:
  providersThrottleDuration: 2s
  docker:
    watch: true
    network: traefik
    defaultrule: Host(`{{ .ContainerName }}.xxxx.com`)
    endpoint: unix:///var/run/docker.sock
  file:
    watch: true
    directory: /etc/traefik
...

by :

...
providers:
  providersThrottleDuration: 2s
  docker:
    watch: true
    network: traefik
    defaultrule: Host(`{{ .ContainerName }}.xxxx.com`)
    endpoint: unix:///var/run/docker.sock
  file:
    watch: true
    filename: /etc/traefik/my_dedicated_file.yaml #or directory: /etc/traefik/my_dedicated_directory
...

And set all the dynamic configuration related to the file provider in the dedicated file (or directory).

@WPF0414
Copy link
Author

WPF0414 commented Mar 18, 2024

I have used the docker label to solve this problem, thank you very much!

@WPF0414 WPF0414 closed this as completed Mar 18, 2024
@lbenguigui lbenguigui removed their assignment Mar 18, 2024
@traefik traefik locked and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants