Connection refused for NextJS inside Docker swarm #55901
Replies: 2 comments 1 reply
-
|
By explicitly setting I found that when I run:
With Docker Swarm when you do: version: "3.7"
services:
app:
image: myimage
ports:
- "3000:3000"
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]Then run:
This seems to come to the fact that Swarm publishes that port via its ingress network , so you typically have to use the node’s actual IP (e.g., Also, if your Next.js server is not listening on I think this comes down to two main things:
TLDR; Set |
Beta Was this translation helpful? Give feedback.
-
|
facing same issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have my private self-hosted docker image with nextjs inside. This image exposes 3000 port.
I tried to run this image via docker and docker swarm.
Result:
docker ps:psinside container:netstat -tulp|grep 3000inside container:curl http://127.0.0.1:3000outputs correct response. So all is fine.stack.yamldocker service lsshows service is online, 1 replicapsinside container:netstat -tulp|grep 3000inside container:But
curl http://127.0.0.1:3000fails:Tried another port, another machines, tried
nodeandpm2. All is same.I can’t understand the reason and where to dig next.
Thank you in advance.
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions