Gunicorn stuck on docker run command using flask

I have a container app_container

that exposes port 8000 according to my application code. The entry point to the container is ENTRYPOINT ["/usr/local/bin/gunicorn", "web_interface:app", "-w 4", "-t 90", "--log-level=info", "-b 127.0.0.1:8000", "--reload"]

.

When I create and run a container with docker run --link postgres_db_container --name foo app_container

, it runs the gunicorn command for the application. Unlike when I run my application locally, it stops at

[2017-06-19 16:01:16 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2017-06-19 16:01:16 +0000] [1] [INFO] Listening at: http://127.0.0.1:8000
[2017-06-19 16:01:16 +0000] [1] [INFO] Using worker: sync
[2017-06-19 16:01:16 +0000] [8] [INFO] Booting worker with pid: 8
[2017-06-19 16:01:16 +0000] [10] [INFO] Booting worker with pid: 10
[2017-06-19 16:01:16 +0000] [11] [INFO] Booting worker with pid: 11
[2017-06-19 16:01:16 +0000] [13] [INFO] Booting worker with pid: 13

      

Can anyone tell me why the shooting process just nods here and doesn't continue?

There will be no mistakes. So, if you have an idea how to get more information, Im all ears ...

Edit:

After canceling the process with control+c

, I see a test print message:

^C[2017-06-19 16:09:27 +0000] [1] [INFO] Handling signal: int
[2017-06-19 16:09:27 +0000] [10] [INFO] Worker exiting (pid: 10)
[2017-06-19 16:09:27 +0000] [11] [INFO] Worker exiting (pid: 11)
[2017-06-19 16:09:27 +0000] [8] [INFO] Worker exiting (pid: 8)
---- Generate Mapping ----
---- Preparing Databases ----

      

So it looks like the Heavy has hung himself on some process, but I don't know how to find out what it is.

+3


source to share


1 answer


Let's offer some combo suggestions:

  • Check that you are mapping the port to your localhost in order to access the container app:

    docker run -p 8000:8000 (rest of the command)
    
          

  • Listen "-b 0.0.0.0:8000"

    instead "-b 127.0.0.1:8000"

    , this is a requirement for docker to display ports. So see docker ps

    , find the character ->

    in the PORTS column (you should see 0.0.0.0:8000->8000

    .



Then go to localhost:8000

in your web browser to check if your app displays correctly.

+1


source







All Articles