错误:不允许使用其他属性db-migrator

问题描述 投票:0回答:1

当我运行docker stack deploy -c docker-stack.yml myapp时,

我收到错误消息:

db-migrator不允许使用其他属性db-migrator

码头工人,stack.yml:

version: "3"

services:
  web:
    image: tenzan/myapp_web:prod
    ports:
      - "80:3000"
    env_file:
      - .env/production/database
      - .env/production/web

  redis:
    image: redis

  database:
    image: postgres
    env_file:
      - .env/production/database
    volumes:
      - db_data:/var/lib/postgresql/data

volumes:
  db_data:

db-migrator:
  image: tenzan/myapp_web:prod
  command: ["./wait-for", "--timeout=300", "database:5432", "--", "bin/rails", "db:migrate"]
  env_file:
    - .env/production/database 
    - .env/production/web
  deploy:
    restart_policy:
      condition: none
docker docker-compose docker-machine
1个回答
1
投票

db-migrator应该在服务之下。

您正在使用YAML文件,这里的结构非常重要。

version: "3"

services:
  web:
    image: tenzan/myapp_web:prod
    ports:
      - "80:3000"
    env_file:
      - .env/production/database
      - .env/production/web

  redis:
    image: redis

  database:
    image: postgres
    env_file:
      - .env/production/database
    volumes:
      - db_data:/var/lib/postgresql/data

  db-migrator:
    image: tenzan/myapp_web:prod
    command: ["./wait-for", "--timeout=300", "database:5432", "--", "bin/rails", "db:migrate"]
    env_file:
      - .env/production/database 
      - .env/production/web
    deploy:
      restart_policy:
        condition: none

volumes:
  db_data:
© www.soinside.com 2019 - 2024. All rights reserved.