我正在尝试配置 traefik + docker,但浏览器永远加载 https url,你知道为什么吗?

I'm trying to configure traefik + docker, but the browser loads the https url forever, do you know why?

我正在尝试配置 traefik + docker 但我遇到了麻烦:浏览器永远加载 URL。 这是我的实际配置:

traefik.toml

debug = false

logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[entryPoints]

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

# https is the default
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]

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

[acme]
email = "marco.castignoli@gmail.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"

然后我有 acme.json,实际上由 treafik 填充了正确的值。

我正在尝试为容器 foo 激活 https,域是 hello.cloud.castignoli.it foo 只有这个标签

traefik.frontend.rule=Host:hello.cloud.castignoli.it

这些是 traefik 的日志

time="2018-10-11T08:04:50Z" level=error msg="Unable to obtain ACME certificate for domains \"reverse-proxy.traefik.\" detected thanks to rule \"Host:reverse-proxy.traefik.\" : unable to generate a certificate for the domains [reverse-proxy.traefik.]: acme: Error 400 - urn:ietf:params:acme:error:malformed - Error creating new order :: DNS name ends in a period"

这是 traefik 仪表板 traefik's dashboard

问题出在尝试为 non-existent 域生成证书的 traefik 域。

docker-compose.yml 中将 labels 设置为您的域,否则不要使用 --api。例如:

  image: traefik                                                                                                                                                                                                                                                                  
  command: --api --docker                                                                                                                                                                                                                                                         
  ports:                                                                                                                                                                                                                                                                            
    - "80:80"                                                                                                                                                                                                                                                                       
    - "443:443"                                                                                                                                                                                                                                                                     
    - "8080:8080"                                                                                                                                                                                                                                                                 
  networks:                                                                                                                                                                                                                                                                         
    - web                                                                                                                                                                                                                                                                         
  volumes:                                                                                                                                                                                                                                                                          
    - /var/run/docker.sock:/var/run/docker.sock                                                                                                                                                                                                                                     
    - /opt/traefik/traefik.toml:/traefik.toml                                                                                                                                                                                                                                       
    - /opt/traefik/acme.json:/acme.json                                                                                                                                                                                                                                           
  labels:                                                                                                                                       
    - "traefik.docker.network=web"                                                                                                                                      
    - "traefik.port=8081"                                                                    
    - "traefik.enable=true"                                                                                                                                       
    - "traefik.frontend.rule=Host:your-awesome-host.com"