Traefik 卡在重启中,不清楚的错误

问题描述 投票:0回答:1

我正在尝试在 docker compose 中运行 traefik 图像,它之前可以工作,但自从我拉取图像后,我从

docker compose logs traefik
获得的唯一日志是
command traefik error: field not found, node: [0]

我尝试在所有 2.10 版本上降级图像(目前为 2.10.5),但没有任何变化。

这是conf文件:

#docker-compose.yml

version: '3.7'
services:
  traefik:
    image: traefik:2.10
    container_name: traefik
    ports:
      - 80:80
      - 443:443
    environment:
      - "TZ=Europe/Paris"
      - "OVH_ENDPOINT_FILE=/run/secrets/ovh_endpoint"
      - "OVH_APPLICATION_KEY_FILE=/run/secrets/ovh_application_key"
      - "OVH_APPLICATION_SECRET_FILE=/run/secrets/ovh_application_secret"
      - "OVH_CONSUMER_KEY_FILE=/run/secrets/ovh_consumer_key"
    secrets:
      - ovh_endpoint
      - ovh_application_key
      - ovh_application_secret
      - ovh_consumer_key
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.yml:/etc/traefik/traefik.yml:ro
      - ./traefik-config/:/etc/traefik/config/:ro
      - ./logs:/var/log/traefik
      - traefik_ssl:/letsencrypt
    networks:
      - traefik
    restart: unless-stopped

  # ... other services that are all running ...

secrets:
  ovh_endpoint:
    file: "./secrets/ovh_endpoint.secret"
  ovh_application_key:
    file: "./secrets/ovh_application_key.secret"
  ovh_application_secret:
    file: "./secrets/ovh_application_secret.secret"
  ovh_consumer_key:
    file: "./secrets/ovh_consumer_key.secret"

volumes:
  traefik_ssl:
    name: traefik_ssl

networks:
  traefik:
    name: traefik

# traefik.yml
global:
  checkNewVersion: true
  sendAnonymousUsage: true

entryPoints:
  http:
    address: :80
    http:
      redirections:
        entryPoint:
          - to: https
          - scheme: https
          - permanent: true
  https:
    address: :443

api:
  dashboard: false

providers:
  docker:
    exposedByDefault: false
  file:
    directory: /etc/traefik/config/
    watch: true
    debugLogGeneratedTemplate: true

certificatesResolvers:
  mydnschallenge:
    acme:
      email: "[email protected]"
      storage: "/letsencrypt/acme.json"
      dnsChallenge:
        provider: ovh
        delayBeforeCheck: 10
log:
  # DEBUG, INFO, WARNING, ERROR, CRITICAL
  level: DEBUG
  filePath: /var/log/traefik/traefik.log
  # common, json
  format: json

accessLog:
  filePath: /var/log/traefik/access.log
  # common, json
  format: json
# middlewares.yml

http:
  middlewares:
    secHeaders:
      headers:
        forceSTSHeader: true
        stsIncludeSubdomains: false
        stsSeconds: 31536000
        frameDeny: true
        contentTypeNosniff: true
        browserXssFilter: true
# tls.yml

tls:
  options:
    default:
      minVersion: VersionTLS12
      sniStrict: true

正如你所看到的,我试图尽可能地放大日志,但我得到的唯一线索是非常神秘的节点 [0] 。

docker docker-compose traefik
1个回答
0
投票

入口点配置错误。

entryPoints:
  http:
    address: :80
    http:
      redirections:
        entryPoint:
          - to: https
          - scheme: https
          - permanent: true
  https:
    address: :443

此处您将序列分配给

entryPoint
,但
to
scheme
permanent
是字段。

这应该可以解决它:

entryPoints:
  http:
    address: :80
    http:
      redirections:
        entryPoint:
          to: https
          scheme: https
          permanent: true
  https:
    address: :443
© www.soinside.com 2019 - 2024. All rights reserved.