简体   繁体   中英

Google Compute Engine: Can't access running Docker container through http request

So I have this running container on GCE and all requests from the outside fail to connect.

if I do docker ps --all i get:

CONTAINER ID   IMAGE                       COMMAND                  CREATED        STATUS        PORTS                                       NAMES
c516555621f0   hydra-parser:hydra-parser   "/bin/sh -c 'gunicor…"   11 hours ago   Up 11 hours   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   nervous_neumann

And it seems that the ports are open too.

imarquezc@hydra-parser:~$ sudo netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      557/sshd            
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      32722/docker-proxy  
tcp6       0      0 :::22                   :::*                    LISTEN      557/sshd            
tcp6       0      0 :::8000                 :::*                    LISTEN      32729/docker-proxy 

Aditionally, if I curl to localhost/0.0.0.0 it works ok

imarquezc@hydra-parser:~$ curl localhost:8000
<h1>EUD Extractor</h1>

Other info:

I already have enabled http and https traffic on google's console.

Also added the default-allow-http, http-server, https-server .network tags

My Dockerfile looks like:

FROM ubuntu:focal

RUN apt-get -y update
RUN apt-get install poppler-utils python3 python3-pip -y


COPY requirements.txt /
RUN pip install --upgrade pip
RUN python3
RUN pip install -r requirements.txt

ADD . /

RUN python3 ./stanza_downloader.py

CMD gunicorn --bind 0.0.0.0:8000 main:app

and I run the container using:

docker run -p 8000:8000 hydra-parser:hydra-parser

What I am missing? Please help!

The tags you are using do not enable port 8000. They enable ports 80 and 443.

Create a VPC firewall ingress rule for port 8000.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM