我在Fargate / CloudFormation上有一个docker容器。我可以通过http客户端连接到端口8080上的socket.io服务器,但是不能直接连接tcp套接字连接(我们的iOS和Android应用程序直接连接,由于它们不使用webviews或http;而是套接字库,因此它们失败了)
如果我测试8080端口,它将失败,但是如果我测试80端口,它将连接(见下文)
nc -vz produ-Publi-10SNDOZB9E1YC-1684595318.us-west-2.elb.amazonaws.com 8080
nc: connectx to produ-Publi-10SNDOZB9E1YC-1684595318.us-west-2.elb.amazonaws.com port 8080 (tcp) failed: Connection refused
nc: connectx to produ-Publi-10SNDOZB9E1YC-1684595318.us-west-2.elb.amazonaws.com port 8080 (tcp) failed: Connection refused
nc -vz produ-Publi-10SNDOZB9E1YC-1684595318.us-west-2.elb.amazonaws.com 80
found 0 associations
found 1 connections:
1: flags=82<CONNECTED,PREFERRED>
outif en0
src 192.168.1.231 port 55691
dst 52.32.233.92 port 80
rank info not available
TCP aux info available
Connection to produ-Publi-10SNDOZB9E1YC-1684595318.us-west-2.elb.amazonaws.com port 80 [tcp/http] succeeded!
DockerFile:
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN mkdir /src
ADD package.json /src
RUN apt-get update
RUN apt-get install --yes curl
RUN curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
RUN apt-get install --yes nodejs
RUN apt-get install --yes build-essential
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
RUN cd /src; npm install
RUN npm install --silent socket.io@0.9.14
WORKDIR /src
# Bundle app source
# Trouble with COPY http://stackoverflow.com/a/30405787/2926832
COPY . /src
ADD app.js /src/
EXPOSE 8080
CMD ["node", "/src/app.js"]