我添加了一个防火墙规则来打开端口8080。如果我单击GCE控制台中的SSH按钮,并在主机shell上运行:
nc -l -p 8080 127.0.0.1
我可以检测到打开的端口。然后,如果我使用以下命令进入容器的shell:
docker run --rm -i -t <image> /bin/sh
并运行相同的netcat命令,我无法检测到打开的端口。
我之所以走这条故障排除路线,是因为我无法连接到为演示websocket服务器运行ws
npm的node:alpine
容器。这是我的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
发布于 2020-01-15 00:03:49
docker run --rm -i -t -p 8080:8080 <image> /bin/sh
https://stackoverflow.com/questions/59736890
复制相似问题