Jan 5 in JSON
Q:

Using Docker-Compose, how to execute multiple commands in YAML?

I want to do something like this where I can run multiple commands in order.

db:
  image: postgres
web:
  build: .
  command: python manage.py migrate
  command: python manage.py runserver 0.0.0.0

1 Answer

0 votes
Jan 5

Figured it out, use bash -c.

Example:

command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"

Same example in multilines:

command: >
    bash -c "python manage.py migrate
    && python manage.py runserver 0.0.0.0:8000"

Or:

command: bash -c "
    python manage.py migrate
    && python manage.py runserver 0.0.0.0:8000
  "
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
Jan 5 in JSON
0 votes
Jan 14 in JSON
...