【问题标题】:Google Compute Engine Container Port Closed谷歌计算引擎容器端口关闭
【发布时间】:2020-01-14 15:27:18
【问题描述】:

我添加了防火墙规则以打开端口 8080。如果我在 GCE 控制台中单击 SSH 按钮,并在主机 shell 上运行:

nc -l -p 8080 127.0.0.1

我可以检测到打开的端口。如果我然后去容器的外壳:

docker run --rm -i -t <image> /bin/sh

并运行相同的 netcat 命令,我无法检测到打开的端口。

我走上了这条故障排除路线,因为我无法连接到运行 ws npm 的 node:alpine 容器,用于演示 websocket 服务器。这是我的 dockerfile:

# specify the node base image with your desired version node:<version>
FROM node:alpine
# replace this with your application's default port
EXPOSE 8080
WORKDIR /app

RUN apk --update add git

【问题讨论】:

  • docker run --rm -i -t -p 8080:8080 &lt;image&gt; /bin/sh 。将容器中的端口暴露给主机。
  • 是的,已修复,谢谢!

标签: docker google-cloud-platform network-programming google-compute-engine netcat


【解决方案1】:
docker run --rm -i -t -p 8080:8080 <image> /bin/sh

Google Compute Engine Container Port Closed

【讨论】:

    猜你喜欢
    • 2023-04-10
    • 2014-10-29
    • 2015-08-05
    • 1970-01-01
    • 2018-05-21
    • 2017-11-29
    • 1970-01-01
    • 2013-12-05
    • 1970-01-01
    相关资源
    最近更新 更多