Traefik自签名证书不执行任何操作(无错误)

时间:2018-07-26 14:47:53

标签: traefik

我有一个有效的主机自签名证书:local.whoami.com。我想在http和https协议上公开虚拟的“ whoami”服务。

#docker-compose.yml

version: '3.6'

services:

  traefik:
    image: traefik
    command:
      - --api
      - --docker
      - --logLevel=INFO
      - --defaultentrypoints=http,https
      - --entryPoints=Name:http Address::80
      - --entryPoints=Name:https Address::443 TLS:/certs/local.whoami.com.crt,/certs/local.whoami.com.key
    ports:
      - "443:443"
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config/cert:/certs/

  whoami:
    image: emilevauge/whoami
    labels:
      traefik.backend: whoami
      traefik.frontend.rule: Host:local.whoami.com
      traefik.enable: true
      traefik.protocol: http
      traefik.frontend.passHostHeader: true

运行docker-compose up成功,没有任何错误:

whoami_1   | Starting up on port 80
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Traefik version v1.6.5 built on 2018-07-10_03:54:03PM"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc420764620} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Preparing server https &{Address::443 TLS:0xc420314800 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc420764700} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Preparing server traefik &{Address::8080 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc4207647c0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Starting provider *docker.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":2,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"unix:///var/run/docker.sock\",\"Domain\":\"\",\"TLS\":null,\"ExposedByDefault\":true,\"UseBindPortIP\":false,\"SwarmMode\":false}"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Starting server on :80"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Starting server on :443"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Starting server on :8080"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Server configuration reloaded on :80"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Server configuration reloaded on :443"
traefik_1  | time="2018-07-26T14:36:41Z" level=info msg="Server configuration reloaded on :8080"

我可以在http://local.whoami.com上成功看到虚拟服务,但是访问安全https://local.whoami.com时,什么都没有发生。 traefik根本没有回应,而chrome显示:

  

无法访问local.whoami.com

     

花了太长时间才回应。

为什么自签名证书不起作用?在没有任何错误的情况下如何跟踪问题?

1 个答案:

答案 0 :(得分:0)

在VirtualBox机器上使用Docker时,我还必须为端口443添加一个端口转发规则。这解决了我的问题。希望对您有所帮助。