I created a Django application which runs inside a Docker container. I needed to create a thread inside the Django application so I used Celery and Redis as the Celery Database.
RUN
commands are adding new image layers only. They are not executed during runtime. Only during build time of the image.
Use CMD
instead. You can combine multiple commands by externalizing them into a shell script which is invoked by CMD
:
CMD start.sh
In the start.sh
script you write the following:
#!/bin/bash
nohup redis-server &
uwsgi --http 0.0.0.0:8000 --module mymodule.wsgi