L
L
LakeForest2021-06-24 23:32:48
Docker
LakeForest, 2021-06-24 23:32:48

How to run 2 processes in docker container?

You need to run both flask and the daemon to clean up files generated by the flask application.
Tried like this but doesn't work:

FROM ubuntu:18.04
...
CMD python3 daemon_clean_wav.py start
CMD gunicorn --access-logfile - -w 4 --bind 0.0.0.0:5000 controller:app --timeout 15000


I don’t want to create an extra container with volumes, how can I configure the launch of two processes differently?
Or is it unreasonable to run 2 processes on 1 container?
Does this approach have significant downsides?
Or is there no difference how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
�
âš¡ Kotobotov âš¡, 2021-06-25
@LakeForest

CMD's are simply arguments that are used by default when starting a container, the last CMD overwrites the previous one.
in general, to run processes in parallel, you can connect commands with an ampersand - &
However, it is better not to do this, hypothetically this will create problems when limiting resources per container, and difficulties when scaling containers.
Well, plus the containers themselves are processes, just with certain layers of insulation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question