Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker Traefik身份验证失败_Docker_Traefik_Toml - Fatal编程技术网

Docker Traefik身份验证失败

Docker Traefik身份验证失败,docker,traefik,toml,Docker,Traefik,Toml,这是我的目标,我想在我的服务器上设置一个反向代理。我以前用Haproxy做这个工作,但我想试试Traefik 首先我想得到Traefik的仪表板页面。它几乎可以工作,一个弹出窗口似乎输入了我的凭据,但它总是失败,即使我确信凭据是正确的 这是我的traefik.toml defaultEntryPoints = ["http", "https"] # Web section is for the dashboard interface [web] address = ":8080" [web.au

这是我的目标,我想在我的服务器上设置一个反向代理。我以前用Haproxy做这个工作,但我想试试Traefik

首先我想得到Traefik的仪表板页面。它几乎可以工作,一个弹出窗口似乎输入了我的凭据,但它总是失败,即使我确信凭据是正确的

这是我的traefik.toml

defaultEntryPoints = ["http", "https"]
# Web section is for the dashboard interface
[web]
address = ":8080"
[web.auth.basic]
  users = ["admin:aaa"]

# entryPoints section configures the addresses that Traefik and the proxied containers can listen on
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect] 
    entryPoint = "https"
[entryPoints.https]
address = ":443"
  [entryPoints.https.tls]
这是运行容器的docker命令

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:monitor.firelabs.fr \
   -l traefik.port=8080 \
   --network proxy \
   --name traefik \
   traefik:1.3.6-alpine --docker --logLevel=DEBUG    
正如您所看到的,我的凭据是admin:aaa,每当我尝试将它们输入对话框时,它都会向我发送以下消息:

time="2017-11-19T13:28:22Z" level=debug msg="Basic auth success..."
正如您所看到的,这是一个非常基本的配置,只需要开始使用Traefik。所以我不知道我错在哪里,我查看了关于web部分配置的文档,它似乎没有错


我是不是漏掉了打字错误

Traefik将密码存储为md5哈希,而不是纯文本。您可以使用htpasswd生成以下内容:

$ htpasswd -nb admin aaa
admin:$apr1$DWU.kdcZ$iqwGcFl9bfwp1WfKHE2yl.
因此,您的traefik.toml文件如下所示:

[web.auth.basic]
users = "admin:$apr1$DWU.kdcZ$iqwGcFl9bfwp1WfKHE2yl."

谢谢你的帮助,就像你说的,因为我使用了纯文本和其他哈希!现在它工作完美!您可以使用在线工具:仅用于测试目的