Question

Created docker container wont start on AppPlatform

Posted August 15, 2021 674 views
DockerFlask

Hey, I deploy my project on App Platform via GitHub, it finds the Dockerfile, on my localhost, everything works ok. Unfortunately, after building the project on App Platform the runtime logs continuously show this:

[back-cany] [2021-08-15 13:28:42] [2021-08-15 13:28:42 +0000] [1] [INFO] Starting gunicorn 20.1.0
[back-cany] [2021-08-15 13:28:42] [2021-08-15 13:28:42 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[back-cany] [2021-08-15 13:28:42] [2021-08-15 13:28:42 +0000] [1] [INFO] Using worker: sync
[back-cany] [2021-08-15 13:28:42] [2021-08-15 13:28:42 +0000] [3] [INFO] Booting worker with pid: 3
[back-cany] [2021-08-15 13:28:42] [2021-08-15 13:28:42 +0000] [4] [INFO] Booting worker with pid: 4
[back-cany] [2021-08-15 13:28:47] [2021-08-15 13:28:47 +0000] [4] [ERROR] Exception in worker process
[back-cany] [2021-08-15 13:28:47] Traceback (most recent call last):
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
[back-cany] [2021-08-15 13:28:47]     worker.init_process()
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 142, in init_process
[back-cany] [2021-08-15 13:28:47]     self.run()
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 125, in run
[back-cany] [2021-08-15 13:28:47]     self.run_for_one(timeout)
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 62, in run_for_one
[back-cany] [2021-08-15 13:28:47]     self.notify()
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 75, in notify
[back-cany] [2021-08-15 13:28:47]     self.tmp.notify()
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/workertmp.py", line 46, in notify
[back-cany] [2021-08-15 13:28:47]     os.fchmod(self._tmp.fileno(), self.spinner)
[back-cany] [2021-08-15 13:28:47] PermissionError: [Errno 1] Operation not permitted
[back-cany] [2021-08-15 13:28:47] [2021-08-15 13:28:47 +0000] [4] [INFO] Worker exiting (pid: 4)
[back-cany] [2021-08-15 13:28:47] [2021-08-15 13:28:47 +0000] [3] [ERROR] Exception in worker process
[back-cany] [2021-08-15 13:28:47] Traceback (most recent call last):
[back-cany] [2021-08-15 13:28:47]   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker

Do you guys have any idea what is going on?

edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
4 answers

Hello,

There was a similar problem reported here:

https://github.com/steamcmd/api/issues/24

The fix reported there was to update the Dockerfile, ENTRYPOINT and CMD to:

ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
CMD ["gunicorn --workers $WORKERS --threads $THREADS --timeout $TIMEOUT --bind :$PORT run:app"]

Let me know how it goes!
Regards,
Bobby

I am also having this error and its driving me nuts.

The dockerfile runs perfectly locally but the minute I attempt to push to the Digital Ocean Apps Platform, it starts repeating like this.

No idea what’s up. Same conditions as you.

The solution suggested can’t apply to me because I’m pulling an “ENTRYPOINT” and the command didn’t work for most people in that github thread.

Hello,

running through this issue as well, I’ve been from this article to this tutorial.

The point is that in a Digital Ocean App using a docker file the tmp directory may not be the one you think (i.e: /tmp).
As explained in the gunicorn FAQ temp directory may be /tmp on some os, /dev/shm on some others or simply no tmpfs have been declared in the fstab.

My guess is that the app service of Digital Ocean is running on an ubuntu cluster and configures each temporary volume to /dev/shm.

Finally, reading the tutorial on how to deploy an app using gunicorn, I noticed that in the screenshot and in the tutorial, the command to be run must point the worker_tmp_dir to /dev/shm (as in the example gunicorn --worker-tmp-dir /dev/shm app:app)

Using this tmp directory solved the issue for me.

NB: I have forced the use of only one worker, I’m going to try with gunicorn’s recommandation (1*number of cores available or at least 3)

by Mason Egger
In this tutorial we will deploy a Flask App Using Gunicorn to DigitalOcean's App Platform.

Also, i found this in the sample apps doc: limits