#Expose a port to a server

1 messages · Page 1 of 1 (latest)

lament night
#

I want to expose the local port 5050 lets say to a server how would i do this? (For a mongodb)

shut edge
#

No point in getting more specific in suggesting solutions until you state what firewall you use; too many possibilities otherwise.

lament night
shut edge
lament night
shut edge
#

I believe it would be 0.0.0.0:5050 to access it from the container. I don't remember if localhost was 0.0.0.0 or the more restrictive 127.0.0.1

#

localhost would probably work

lament night
#

I dont think i have any luck, doesnt seem to work. I wonder if i have to docker expose the ports or something

shut edge
#

What is your node's allocation?

#

If it's 127.0.0.1 it's isolated and you could try 0.0.0.0 or 172.18.0.1

#

Also your database's user, is it configured to access connections from everywhere (%) or your containers (172.18.0.1)?

shut edge
lament night
#

---------[ERROR]---------
connect ECONNREFUSED 127.0.0.1:5050

---------[ERROR]---------
connect ECONNREFUSED 172.18.0.1:5050

---------[ERROR]---------
connect ECONNREFUSED 0.0.0.0:5050

#
sudo ufw allow from 172.18.0.0/16 to any port 5050
#

The database's user is fine

lament night