Sheena
Sheena

Reputation: 16242

GAE inside docker. cant expose 8080

I have a GAE application and a bunch of people working on it so to save people the trouble of setting up all the dependencies and whatnot I was hoping to allow them to run the gae development server in a docker container.

My dockerfile ends with:

CMD dev_appserver.py app_localhost.yaml

And my docker-compose is like:

version: '3'
services:
  my_image:
    build: ./my_image
    image: my_image
    ports:
      - "8080:8080"
      - "8000:8000"
    volumes:
      - ./my_image:/usr/src/

building this works fine. And running it with docker-compute up also seems to work fine. I mean, it has friendly output saying that the default module is accessible at 8080 and all that good stuff.

But if I access localhose:8080 via chrome I get ERR_SOCKET_NOT_CONNECTED. If I try curl it I get curl: (56) Recv failure: Connection reset by peer.

It all runs fine and is accessable when I run it outside the container.

docker ps                                                                                                                                                                                    56 ↵
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
3a2ae48f1f66        waxed_backend_image   "/bin/sh -c 'dev_a..."   9 hours ago         Up 8 hours          0.0.0.0:8000->8000/tcp, 0.0.0.0:8080->8080/tcp   dockerpygae_waxed_backend_1

Here's a possibly related problem I have: making requests to localhost from inside docker container It seems that every time I try to communicate with the gae development server in any dockery way things start to go horribly wrong

Upvotes: 0

Views: 349

Answers (1)

Sheena
Sheena

Reputation: 16242

I changed this:

CMD dev_appserver.py app_localhost.yaml

To this:

CMD dev_appserver.py --host 0.0.0.0 app_localhost.yaml

And now it works fine

Although I dont know why it worked. I'll still appreciate an answer tht is more correct than this one

Upvotes: 4

Related Questions