简体   繁体   English

docker中的GAE。 不能暴露8080

[英]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. 我有一个GAE应用程序,并且有很多人在处理它,这样可以避免人们设置所有依赖项的麻烦,而我希望允许他们在docker容器中运行gae开发服务器。

My dockerfile ends with: 我的dockerfile结尾为:

CMD dev_appserver.py app_localhost.yaml

And my docker-compose is like: 我的docker-compose就像这样:

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. 并且使用docker-compute up运行它似乎也可以正常工作。 I mean, it has friendly output saying that the default module is accessible at 8080 and all that good stuff. 我的意思是,它具有友好的输出,表示默认模块可在8080和所有好的东西中访问。

But if I access localhose:8080 via chrome I get ERR_SOCKET_NOT_CONNECTED. 但是,如果我通过Chrome访问localhose:8080,则会得到ERR_SOCKET_NOT_CONNECTED。 If I try curl it I get curl: (56) Recv failure: Connection reset by peer . 如果尝试curl则会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 这是一个可能与我相关的问题: 从docker容器中向本地主机发出请求似乎每次我尝试以任何固定方式与gae开发服务器进行通信时,事情都会发生严重错误

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 我仍然会感谢一个比这个答案更正确的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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