我运行下面 3 个容器来设置 zabbix GUI 应用程序。
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e3f2d650434 zabbix/zabbix-web-nginx-mysql:latest "docker-entrypoint.sh" 5 hours ago Up 4 hours 8080/tcp, 8443/tcp, 0.0.0.0:8080->80/tcp zabbix-web-nginx-mysql
5d900c79adc0 zabbix/zabbix-server-mysql:latest "/sbin/tini -- /usr/…" 5 hours ago Up 4 hours 0.0.0.0:10051->10051/tcp zabbix-server-mysql
30c8a58f8ea3 mysql:5.7 "docker-entrypoint.s…" 12 hours ago Up 4 hours 3306/tcp, 33060/tcp mysql-server
你看zabbix/zabbix-web-nginx-mysql
,它有0.0.0.0:8080 -> 80/tcp
。
但我无法127.0.0.1:8080
从我的主机访问。
我用nmap检查了8080端口,它已经开放了。
$ nmap 127.0.0.1 -p 8080
Starting Nmap 7.92 ( https://nmap.org ) at 2021-11-03 15:20 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00036s latency).
PORT STATE SERVICE
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
但我无法访问它
$ curl 127.0.0.1:8080
curl: (52) Empty reply from server
并且无法进入容器:当我执行docker connect命令时,它会卡住:
$ docker attach 6e3f2d650434