How to run a Redis server AND another application inside Docker?

后端 未结 3 1258
执念已碎
执念已碎 2021-02-14 11:42

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.

3条回答
  •  情歌与酒
    2021-02-14 12:16

    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
    

提交回复
热议问题