我想做这样的事情,我可以依次运行多个命令。
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 "