我使用Docker在端口8080上设置了Traefik的仪表板,但我只能在主机上访问它。
ufw
,iptables
和firewalld
未启用。 nmap
显示
$ nmap -p 8080 localhost
Starting Nmap 7.01 ( https://nmap.org ) at 2018-02-04 01:51 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0029s latency).
PORT STATE SERVICE
8080/tcp open http-proxy`
完成Nmap:1个IP地址(1个主机)在0.04秒内扫描
curl
显示
$ curl localhost:8080
<a href="/dashboard/">Found</a>
$ curl xxx.xxx.xxx.xx:8080
<a href="/dashboard/">Found</a>.
netstat
显示
$ netstat -vatn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::2376 :::* LISTEN
tcp6 0 0 :::2377 :::* LISTEN
tcp6 0 0 :::7946 :::* LISTEN
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 xxx.xxx.xxx.xx:2377 xxx.xxx.xxx.xxx:55446 ESTABLISHED
这是尝试在端口8080上访问服务器的尝试,只显示超时。
这里试图从另一台机器卷曲
$ curl xxx.xxx.xxx.xx:8080
curl: (7) Failed to connect to xxx.xxx.xxx.xx port 8080: Timed out
我能够在端口80
上找到它(在Traefik后面有一个空的nginx重定向服务器)
$ curl xxx.xxx.xxx.xx
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.13.8</center>
</body>
</html>
编辑:根据要求包括TOML
accessLogsFile = "/dev/stdout"
defaultEntryPoints = ["https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
CertFile = "/run/secrets/cert.pem"
KeyFile = "/run/secrets/key.pem"
[web]
address = ":8080"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "localhost"
watch = true
swarmmode = true
exposedbydefault = false