Running a flask app and celery worker in the same docker container.
Run a flask application and celery worker in the same Docker container
This is purely an illustrative example, but you can fork it and use it as a template. The example shows how to properly configure supervisord, celery, flask and docker. Take inspiration from it.
The strategy used is to run the flask application, the celery worker and celerybeat worker as programs using supervisord. Pipe all their stdout to the docker container's stdout, et voila. Using docker-compose, we connect to an external redis container, but as long as you change the backend URLs in the celery configuration to whatever persistent backend you have, then the example should work as a standalone docker container.
If you would like to contribute something to this example, please feel free to open a PR and contact me @pm990320.