Port 80 not opened to my container after creating firewall rules

825 views
Skip to first unread message

Lucky Adogun

unread,
Mar 16, 2021, 11:58:54 AM3/16/21
to gce-discussion
Hi,

I have a container running Django, Nginx, and Gunicorn running on Compute Engine

I can successfully deploy and SSH into the VM but cannot access the external URL to the container despite creating several firewall rules.

It seems to be closed to port 80 even after exposing it from within the VM.

how do I fix this?

Here's a copy of my:

docker-compose file: https://codeshare.io/aJZBWd



Here's the error I get when I try to access port 80: curl: (7) Failed to connect to 35.XXX.XX.XXX port 80: Connection refused


Jedihomer Townend

unread,
Mar 17, 2021, 12:41:05 PM3/17/21
to gce-discussion
I may be reading that wrong, but it looks like you are mapping port 1337 to 80 in your docker-compose file.

So although you have NGINX listening on port 80 (inside the docker) you are actually listening on port 1337 on the VM

Lucky Adogun

unread,
Mar 17, 2021, 1:02:16 PM3/17/21
to gce-discussion

Yes. 1337 is mapped to 80. Visiting HTTP://my-external-ip:1337 doesn't return a proper response.

Jedihomer Townend

unread,
Mar 17, 2021, 1:40:57 PM3/17/21
to gce-discussion

So I also assume that you've opened port 1337 in your GCP firewall rules?  From your initial email I read that as you've opened port 80 in the firewall...

Lucky Adogun

unread,
Mar 17, 2021, 1:58:38 PM3/17/21
to gce-discussion
Thanks. Yes, I have that port opened as well.

Wilfred L. (Cloud Platform Support)

unread,
Mar 17, 2021, 5:13:32 PM3/17/21
to gce-discussion
Hi, your nginx file has the following line:

listen [::]:80 ipv6only=on;

Have you tried remove it?

Lucky Adogun

unread,
Mar 17, 2021, 8:43:02 PM3/17/21
to gce-discussion

Yes. I've removed it. Made changes and tested locally - which works.

Updated the image on Artifact Registry and the VM.

Here's what I get when I SSH into it and checked the journalctl logs: 

konlet-startup.service: Main process exited, code=exited, status=1/FAILURE
konlet-startup.service: Failed with result 'exit-code'

Any clue what may be wrong as the container isn't running?
Reply all
Reply to author
Forward
0 new messages