我全新安装了 Ubuntu 服务器 22.04。我无法连接到我的 docker 容器。以下是更多信息:
ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
80 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96c1479b1a2c nginx "/docker-entrypoint.…" 2 hours ago Up 5 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp nginx-container
curl localhost
和curl 192.168.0.134
(来自同一服务器)
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
curl 192.168.0.134
从我用来 ssh 访问的设备:
curl: (28) Failed to connect to 192.168.0.134 port 80 after 25916 ms: Operation timed out
浏览器(Chrome)上也有同样的问题
从主机 ping 到服务器的工作情况:
ping 192.168.0.134
PING 192.168.0.134 (192.168.0.134): 56 data bytes
64 bytes from 192.168.0.134: icmp_seq=0 ttl=64 time=2.039 ms
64 bytes from 192.168.0.134: icmp_seq=1 ttl=64 time=2.225 ms
64 bytes from 192.168.0.134: icmp_seq=2 ttl=64 time=3.588 ms
有什么想法吗?在我看来,docker 和 ufw 配置正确,我希望我的路由器没有阻止任何东西(主机是带 wifi 的笔记本电脑,服务器通过电缆连接,ssh 工作正常,因此设备可能已连接)