How do I execute multiple commands in command in a docker-compose.yml file?

< H1 > problem description < / H1 >

I want to use docker to package my Django project, and then use docker-compose for service orchestration to run the database needed by the Django project. Suppose the content in docker-compose.yml is as follows:

version: "3"
services:
    web:
        image: my_project:latest
        ports:
          - 8000:8000
        command: python3 manage.py runserver 0.0.0.0:8000
        depends_on:
          - postgres
    postgres:
        image: postgres

before running python3 manage.py runserver 0.0.0.0 code 8000 , I want to use python3 manage.py migrate to Synchronize the structure of the database. Where should I add this order?


if there is another longer script that needs to be written on a new line, write it as follows

command: python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e51-2bfd9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e51-2bfd9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?