繁体   English   中英

Traefik初始化在带有acme.json的docker容器中失败。 “在创建TLS配置时收到错误:私钥为nil”

[英]Traefik initialization is failed in docker container with acme.json . “Receiving Error creating TLS config: private key was nil”

我试图用acme.json设置Traefik,但是在容器启动时,我得到以下错误

level=error msg="Cannot unmarshall private key []"
level=error msg="Error creating TLS config: private key was nil"
level=fatal msg="Error preparing server: private key was nil"


docker run -d \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $PWD/traefik.toml:/traefik.toml \
  -v $PWD/acme.json:/acme.json \
  -p 80:80 \
  -p 443:443 \
  -l traefik.frontend.rule=Host:abc.com\
  -l traefik.port=8080 \
  --network proxy \
  --name traefik \
  traefik:1.3.6-alpine --docker

traefik.toml traefix配置文件:

defaultEntryPoints = ["http", "https"]
[web]
address = ":8080"
  [web.auth.basic]
  users = ["admin:$apr1$fwifc.Nx$xfuaGzJ6Jzdf347PQzxD95"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
          entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
[acme]
email = "abc@msn.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
onDemand = false

根据文档,您还可以将“ tls证书 ”放置在全局配置文件traefik.toml中,而不是这样:

[entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
      CertFile = "integration/fixtures/https/snitest.com.cert"
      KeyFile = "integration/fixtures/https/snitest.com.key"
      [[entryPoints.https.tls.certificates]]
      CertFile = "integration/fixtures/https/snitest.org.cert"
      KeyFile = "integration/fixtures/https/snitest.org.key"

你可以找到更多的信息, 这里的计算器,并在这里

请也遵循本教程

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM