Gunicorn stuck on docker when run is executed with flask application

0 votes

I'm running a container app_container built, exposing port 8000 and with its entry point being ENTRYPOINT ["/usr/local/bin/gunicorn", "web_interface:app", "-w 4", "-t 90", "--log-level=info", "-b 127.0.0.1:8000", "--reload"].

My container stops if I try and run the app locally but  if I run it with docker run --link postgres_db_container --name foo app_container, the gunicorn command runs to the app.

Locally the container stops here:

[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

If I interrupt the process it shows 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 ----

I think Gunicorn is stuck on some process.

Am I doing anything wrong here? There isn't even any error for me to troubleshoot them.

Jun 13, 2018 in DevOps Tools by DragonLord999
• 8,380 points
700 views

1 answer to this question.

0 votes

Here's something that you could try:

  • Check your port is mapping to you localhost so that it can access the container

    docker run -p 8000:8000 (rest of the command)
  • Also, change your listening port to "-b 127.0.0.1:8000" from "-b 0.0.0.0:8000". this is kinda requirement for docker to map ports. In docker ps you'll see 0.0.0.0:8000->8000

Now, check your localhost:8000 in your web browser to see if the app is working properly.

answered Jun 13, 2018 by ajs3033
• 7,280 points

Related Questions In DevOps Tools

0 votes
1 answer

Want a command to be executed in Salt only if a directory is empty

You should consider using this inside your ...READ MORE

answered Jun 12, 2018 in DevOps Tools by Damon Salvatore
• 5,510 points
40 views
0 votes
1 answer
0 votes
1 answer

How do I run “ant update” in Hybris with only “Update Running System”?

Here is what you can try. You can ...READ MORE

answered Jul 10, 2018 in DevOps Tools by Atul
• 10,240 points
1,386 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,900 points
189 views
0 votes
1 answer

running comands as non-root user while using docker-maven plugin

Docker needs root access therefore maven commands ...READ MORE

answered Apr 30, 2018 in DevOps Tools by ajs3033
• 7,280 points
558 views
0 votes
1 answer