我想做这样的事情,我可以按顺序运行多个命令。
db: image: postgres web: build: . command: python manage.py migrate command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" links: - db
想通了,用 bash -c 。
bash -c
例子:
command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
多行中的相同示例:
command: > bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
要么:
command: bash -c " python manage.py migrate && python manage.py runserver 0.0.0.0:8000 "