One - One Code All

Blog Content

docker-compose.yml中配置docker执行命令

容器化   2020-06-13 17:42:02

使用command

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
  "

docker-compose.yaml例子

version: '3'

services:
  app:
    build:
      context: .
    command: >
      sh -c "python manage.py wait_for_db &&
             python manage.py migrate &&
             python manage.py runserver 0.0.0.0:8000"



上一篇:使用Harbor自建企业级Docker镜像仓库
下一篇:k8s将pod运行到指定的节点上,给节点打标签

The minute you think of giving up, think of the reason why you held on so long.