Home > Enterprise >  Does it make sense to demonize celery when running on a dedicated docker container?
Does it make sense to demonize celery when running on a dedicated docker container?

Time:06-22

I have a celery worker running on a container and the documentation suggest to daemonize it for production, but is it also necessary when running it on a container? For start, when I daemonize it on a container the worker starts ok, but the container exits with code 0 since there is no foreground process running.

CodePudding user response:

The single program that runs in a container needs to not daemonize. Depending on the program, you may need a --foreground option or similar, or simply to not specify a --daemon option. As you note, if the program goes through the double-fork mechanic to create a daemon process and then exits, that will also cause the container to exit.

This is true for Celery workers too, though not at all specific to Celery.

  • Related