【问题标题】:Expose container to internet on coreos在 coreos 上将容器暴露给互联网
【发布时间】:2019-09-04 18:39:41
【问题描述】:

我有一个用于 Web 应用程序的容器,其中 80 端口绑定到同一端口上的主机。主机使用 coreos 发行版运行。 服务器有一个公共地址,如果我从本地网络之外的设备对其进行 ping 操作,我会得到 100% 的响应,但无法访问 Web 应用程序...

【问题讨论】:

  • 你主机上docker ps的输出是什么?
  • nginx:alpine "nginx -g 'daemon of..." 7 天前 Up 7 days 0.0.0.0:80->80/tcp project-webserver

标签: linux docker firewall portforwarding coreos


【解决方案1】:

你确定 webapp 真的在运行吗?您可以从 CoreOS 主机访问 webapp 吗?您可以 ssh 进入主机并运行 nc -z localhost 80 进行检查。如果你的连接被拒绝,那么你的 webapp 没有运行。如果您可以访问它,那么它可能是防火墙,您需要打开端口 80 以在 coreOS 主机上进行 tcp 流量。

【讨论】:

  • 是的,我确定,因为我可以从本地主机设备访问 Web 应用程序
  • 防火墙是否在运行? systemctl status iptables.service如果防火墙正在运行,您需要打开端口 80 以进行 tcp 流量。
  • 接受 tcp -- 随时随地 tcp dpt:http
猜你喜欢
  • 2017-06-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多