Traefik正在使用traefik.enable = true设置忽略docker

前端之家收集整理的这篇文章主要介绍了Traefik正在使用traefik.enable = true设置忽略docker 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

您期望看到什么?

我期望在docker组成wordpress堆栈时看到一个新的前端和后端.

您看到了什么?

没有新的前端或后端. 2条日志行= level = info msg =“为提供商docker跳过相同的配置”

即使在标签中设置了traefik.enable = true,也将看到“过滤禁用的容器/ testEXAMPLEcom_wordpress_1”.

traefik版本的输出

Traefik version v1.7.11 built on 2019-04-26_08:42:33AM

您的环境是什么?组态?

cat traefik.toml
#debug = true

logLevel = "INFO" #DEBUG,INFO,WARN,ERROR,FATAL,PANIC
InsecureSkipVerify = true
defaultEntryPoints = ["https","http"]

# WEB interface of Traefik - it will show web page with overview of frontend and backend configurations
[api]
  entryPoint = "traefik"
  dashboard = true
  address = ":8080"

# Force HTTPS
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"

  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [entryPoints.https.redirect]
        permanent=true
        regex = "^https://www.(.*)"
        replacement = "https://$1"

[retry]

[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
exposedByDefault = false

# Let's encrypt configuration
[acme]
email = "japayton42@gmail.com" #any email id will work
storage="/etc/traefik/acme/acme.json"
entryPoint = "https"
acmeLogging=true
onDemand = false #create certificate when container is created
onHostRule = true
caServer = "https://acme-v02.api.letsencrypt.org/directory"
[acme.dnsChallenge]
  provider = "cloudflare"
  delayBeforeCheck = 3
cat docker-compose.yml
version: "3.6"
services:

  traefik:
    hostname: traefik
    image: traefik:latest
    container_name: traefik
    restart: always
    domainname: ${DOMAINNAME}
    networks:
      - default
      - traefik_proxy
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    environment:
      - CF_API_EMAIL=${CLOUDFLARE_EMAIL}
      - CF_API_KEY=${CLOUDFLARE_API_KEY}
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:${DOMAINNAME}; PathPrefixStrip: /traefik"
      - "traefik.port=8080"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=0"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=false"
      - "traefik.frontend.headers.SSLHost=host.EXAMPLE.com"
      - "traefik.frontend.headers.STSIncludeSubdomains=false"
      - "traefik.frontend.headers.STSPreload=false"
      - "traefik.frontend.headers.frameDeny=true"
      - "traefik.frontend.auth.basic.users=${HTTP_USERNAME}:${HTTP_PASSWORD}"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${USERDIR}/traefik:/etc/traefik
      - ${USERDIR}/shared:/shared


networks:
  traefik_proxy:
    external:
      name: traefik_proxy
  default:
    driver: bridge
cat docker-compose.yml
version: '3.3'

services:
  db:
    image: MysqL:latest
    volumes:
      - ./db_data:/var/lib/MysqL
    restart: always
    environment:
      MysqL_ROOT_PASSWORD: somewordpress
      MysqL_DATABASE: wordpress
      MysqL_USER: wordpress
      MysqL_PASSWORD: wordpress
    labels:
      - traefik.enable=false
    networks:
      - db
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    restart: always
    volumes:
      - ./app:/var/www
    environment:
      wordpress_DB_HOST: db:3306
      wordpress_DB_USER: wordpress
      wordpress_DB_PASSWORD: wordpress
      wordpress_DB_NAME: wordpress
    labels:
      - "traefik.enabled=true"
      - "traefik.domain=test.EXAMPLE.com"
      - "traefik.backend=test.EXAMPLE.com"
      - "traefik.frontend.rule=Host:www.test.EXAMPLE.com,test.EXAMPLE.com"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.port=80"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=0"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=false"
      - "traefik.frontend.headers.SSLHost=EXAMPLE.com"
      - "traefik.frontend.headers.STSIncludeSubdomains=false"
      - "traefik.frontend.headers.STSPreload=false"
      - "traefik.frontend.headers.frameDeny=true"
    networks:
      - traefik_proxy
      - db
networks:
  traefik_proxy:
    external: true
  db:
    external: false

如果适用,请将日志输出粘贴到DEBUG级别

Attaching to traefik
traefik    | time="2019-05-04T00:29:34Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml"
traefik    | time="2019-05-04T00:29:34Z" level=info msg="Traefik version v1.7.11 built on 2019-04-26_08:42:33AM"
traefik    | time="2019-05-04T00:29:34Z" level=debug msg="Global configuration loaded {\"LifeCycle\":{\"RequestAcceptGraceTimeout\":0,\"GraceTimeOut\":10000000000},\"GraceTimeOut\":0,\"Debug\":false,\"CheckNewVersion\":true,\"SendAnonymousUsage\":false,\"AccessLogsFile\":\"\",\"AccessLog\":null,\"TraefikLogsFile\":\"\",\"TraefikLog\":null,\"Tracing\":null,\"LogLevel\":\"DEBUG\",\"EntryPoints\":{\"http\":{\"Address\":\":80\",\"TLS\":null,\"Redirect\":{\"entryPoint\":\"https\"},\"Auth\":null,\"WhitelistSourceRange\":null,\"WhiteList\":null,\"Compress\":false,\"ProxyProtocol\":null,\"ForwardedHeaders\":{\"Insecure\":true,\"TrustedIPs\":null}},\"https\":{\"Address\":\":443\",\"TLS\":{\"MinVersion\":\"\",\"CipherSuites\":null,\"Certificates\":null,\"ClientCAFiles\":null,\"ClientCA\":{\"Files\":null,\"Optional\":false},\"DefaultCertificate\":null,\"SniStrict\":false},\"Redirect\":{\"regex\":\"^https://www.(.*)\",\"replacement\":\"https://$1\",\"permanent\":true},\"traefik\":{\"Address\":\":8080\",\"Redirect\":null,\"TrustedIPs\":null}}},\"Cluster\":null,\"Constraints\":[],\"ACME\":{\"Email\":\"EXAMPLE@gmail.com\",\"Domains\":null,\"Storage\":\"/etc/traefik/acme/acme.json\",\"StorageFile\":\"\",\"OnDemand\":false,\"OnHostRule\":true,\"CAServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"EntryPoint\":\"https\",\"KeyType\":\"\",\"DNSChallenge\":{\"Provider\":\"cloudflare\",\"DelayBeforeCheck\":3000000000,\"Resolvers\":null,\"DisablePropagationCheck\":false},\"HTTPChallenge\":null,\"TLSChallenge\":null,\"DNSProvider\":\"\",\"DelayDontCheckDNS\":0,\"ACMELogging\":true,\"OverrideCertificates\":false,\"TLSConfig\":null},\"DefaultEntryPoints\":[\"https\",\"http\"],\"ProvidersThrottleDuration\":2000000000,\"MaxIdleConnsPerHost\":200,\"IdleTimeout\":0,\"InsecureSkipVerify\":true,\"RootCAs\":null,\"Retry\":{\"Attempts\":0},\"HealthCheck\":{\"Interval\":30000000000},\"RespondingTimeouts\":null,\"ForwardingTimeouts\":null,\"AllowMinWeightZero\":false,\"KeepTrailingSlash\":false,\"Web\":null,\"Docker\":{\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"\",\"ExposedByDefault\":false,\"UseBindPortIP\":false,\"SwarmMode\":false,\"Network\":\"\",\"SwarmModeRefreshSeconds\":15},\"File\":null,\"Marathon\":null,\"Consul\":null,\"ConsulCatalog\":null,\"Etcd\":null,\"Zookeeper\":null,\"Boltdb\":null,\"Kubernetes\":null,\"Mesos\":null,\"Eureka\":null,\"ECS\":null,\"Rancher\":null,\"DynamoDB\":null,\"ServiceFabric\":null,\"Rest\":null,\"API\":{\"EntryPoint\":\"traefik\",\"Dashboard\":true,\"CurrentConfigurations\":null,\"Statistics\":null},\"Metrics\":null,\"Ping\":null,\"HostResolver\":null}"
traefik    | time="2019-05-04T00:29:34Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
traefik    | time="2019-05-04T00:29:34Z" level=debug msg="Setting Acme Certificate store from Entrypoint: https"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Preparing server traefik &{Address::8080 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc000376be0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Creating entry point redirect http -> https"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Creating regex redirect https -> ^https://www.(.*) -> https://$1"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:0xc00019b500 Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc000376c00} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Creating entry point redirect http -> https"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Creating regex redirect https -> ^https://www.(.*) -> https://$1"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Preparing server https &{Address::443 TLS:0xc00042aab0 Redirect:0xc00019b680 Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc000376ba0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting server on :8080"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting server on :80"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting provider configuration.ProviderAggregator {}"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting server on :443"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting provider *docker.Provider {\"Watch\":true,\"SwarmModeRefreshSeconds\":15}"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Starting provider *acme.Provider {\"Email\":\"EXAMPLE@gmail.com\",\"Store\":{}}"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Testing certificate renew..."
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Configuration received from provider ACME: {}"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Provider connection established with docker 18.09.5 (API 1.39)"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Filtering disabled container /traefik"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Configuration received from provider docker: {}"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Adding certificate for domain(s) host.EXAMPLE.com"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :80"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :443"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :8080"
traefik    | time="2019-05-04T00:29:35Z" level=debug msg="Adding certificate for domain(s) host.EXAMPLE.com"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :8080"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :80"
traefik    | time="2019-05-04T00:29:35Z" level=info msg="Server configuration reloaded on :443"
traefik    | time="2019-05-04T00:29:49Z" level=debug msg="Provider event received {Status:start ID:58b2b12336a7488012b68fed21f90476a1e791f4aa17fff7bd266ee9dfbe7a68 From:MysqL:latest Type:container Action:start Actor:{ID:58b2b12336a7488012b68fed21f90476a1e791f4aa17fff7bd266ee9dfbe7a68 Attributes:map[image:MysqL:latest com.docker.compose.config-hash:f4e61702252003fcfa77f925b989f7ea4933faa6e0735d189d265eabcb5fa799 com.docker.compose.container-number:1 com.docker.compose.service:db com.docker.compose.version:1.24.0 name:testEXAMPLEcom_db_1 traefik.enable:false com.docker.compose.oneoff:False com.docker.compose.project:testEXAMPLEcom]} Scope:local Time:1556929789 TimeNano:1556929789841010516}"
traefik    | time="2019-05-04T00:29:49Z" level=debug msg="Filtering disabled container /testEXAMPLEcom_db_1"
traefik    | time="2019-05-04T00:29:49Z" level=debug msg="Filtering disabled container /traefik"
traefik    | time="2019-05-04T00:29:49Z" level=debug msg="Configuration received from provider docker: {}"
traefik    | time="2019-05-04T00:29:49Z" level=info msg="Skipping same configuration for provider docker"
traefik    | time="2019-05-04T00:29:50Z" level=debug msg="Provider event received {Status:start ID:6d816029188e7a2ff7b7d37fec254e21424cb3e2f69b42c81638d40d56d818f3 From:wordpress:latest Type:container Action:start Actor:{ID:6d816029188e7a2ff7b7d37fec254e21424cb3e2f69b42c81638d40d56d818f3 Attributes:map[com.docker.compose.version:1.24.0 traefik.docker.network:traefik_proxy traefik.domain:test.EXAMPLE.com traefik.enabled:true traefik.frontend.headers.SSLHost:EXAMPLE.com traefik.frontend.headers.browserXSSFilter:true com.docker.compose.container-number:1 traefik.frontend.headers.STSPreload:false traefik.frontend.headers.STSSeconds:0 traefik.frontend.headers.contentTypeNosniff:true traefik.frontend.headers.forceSTSHeader:false com.docker.compose.oneoff:False com.docker.compose.service:wordpress traefik.frontend.headers.SSLRedirect:true traefik.frontend.rule:Host:www.test.EXAMPLE.com,test.EXAMPLE.com traefik.port:80 com.docker.compose.config-hash:3e163655e60a2111f256d3abc3289244f21676737888f7f4340cd543d82300d0 com.docker.compose.project:testEXAMPLEcom image:wordpress:latest name:testEXAMPLEcom_wordpress_1 traefik.frontend.headers.STSIncludeSubdomains:false traefik.frontend.headers.frameDeny:true]} Scope:local Time:1556929790 TimeNano:1556929790976253470}"
traefik    | time="2019-05-04T00:29:50Z" level=debug msg="Filtering disabled container /testEXAMPLEcom_wordpress_1"
traefik    | time="2019-05-04T00:29:50Z" level=debug msg="Filtering disabled container /testEXAMPLEcom_db_1"
traefik    | time="2019-05-04T00:29:50Z" level=debug msg="Filtering disabled container /traefik"
traefik    | time="2019-05-04T00:29:50Z" level=debug msg="Configuration received from provider docker: {}"
traefik    | time="2019-05-04T00:29:50Z" level=info msg="Skipping same configuration for provider docker"
最佳答案
我正在使用traefik.enabled而不是traefik.enable

在发布之前,我尝试了一个星期,

猜你在找的Docker相关文章