-
If you listen using "localhost" in docker the app will refuse all inbound connections. BEFORE:
app.listen('localhost', 2002, () => {
console.log("FUCK")
})
AFTER:
app.listen('*', 2002, () => {
console.log("FUCK")
}) Just thought i'd save someone else an entire day debugging this torturous problem. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can also just do app.listen(2002). If you want to bind to any one interface you have to make sure you actually have that interface up, using something like ifconfig |
Beta Was this translation helpful? Give feedback.
-
I had the same issue! const PORT = 3000
app.listen('::', PORT, token => {
debug.info(token ? `Server listening on port ${PORT}` : `Failed to listen to port ${PORT}`)
}) Now, the container is listening the ~/app $ netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:46767 0.0.0.0:* LISTEN -
tcp 0 0 :::3000 :::* LISTEN 1/node PS: Build from |
Beta Was this translation helpful? Give feedback.
You can also just do app.listen(2002). If you want to bind to any one interface you have to make sure you actually have that interface up, using something like ifconfig