Docker not mapping port using gunicorn

前端 未结 1 1472
星月不相逢
星月不相逢 2020-12-03 22:50

I\'m running gunicorn inside a docker container. I know this works because sshing into it and curling localhost:8000/things in docker container gives me the response I want,

相关标签:
1条回答
  • 2020-12-03 23:42

    When you publish a port, Docker will forward requests into the container, but the container needs to be listening for them. The container has an IP address from the Docker network, and your app needs to be listening on that address.

    Check your gunicorn bind setting - if it's only listening on 127.0.0.1:8000 then it's not binding to the container's IP address, and won't get requests from outside. 0.0.0.0:8000 is safe as it will bind to all addresses.

    0 讨论(0)
提交回复
热议问题