Reputation: 960
I managed to successfully deploy a docker image to a VM instance. How can I send network requests to it?
The code is a simple Node.js / express app that simply res.json()
"Hi there!" on the root path. It is listening on port 3000.
I think the deploy process was this:
docker ps
and see running container with correct image tagcurl
(I am using zsh terminal) as well as browser to check network requests. Getting connection refused error
As a beginner, the google firewall settings appear to be open--I have allowed ingress on all ports.
I will also want to allow egress at some point but for now my problem is that I am getting a connection refused error
whenever I try to contact the IP address, either with my web-browser or curl
from the command line.
It would seem that the issue is most likely with the firewalls, and I have confirmed that my docker container is running in the VM (and the source code works on my machine).
EDIT:
Updated Firewall Rules with Port 3000 Ingress:
Upvotes: 1
Views: 1303
Reputation: 57
Just in case you hit this bump as well :>
The docker Nginx was accessible from the host but not from the internet :(
After the upgrade the Nginx docker was accessible from the internet :)
The only change i noticed after the upgrade is the additional port export:
:::7070->80/tcp
Upvotes: 1
Reputation: 40081
You need a firewall rule that permits traffic to tcp:3000
.
Preferably from just your host's IP (Google "what's my IP?" And use that) but for now you can (temporarily) use any IP 0.0.0.0/0
.
Firewall rules can be applied only to the VM running your container too, but I'd not worry about that initially.
Upvotes: 1