docker - 错误:不允许附加属性 db-migrator
问题描述
当我跑步时docker stack deploy -c docker-stack.yml myapp
,
我收到错误消息:
db-migrator 不允许附加属性 db-migrator
码头工人堆栈.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
解决方案
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:
推荐阅读
- python - Recognizer.read('trainer/trainer.yml) 找不到 trainer.yml 文件
- go - 需要帮助理解 Golangs 包和模块系统的困惑
- html - 在其中自定义 bootstrap 5 按钮颜色和属性
- sqlite - 创建具有依赖项(gradle 或 maven)的可执行 fat jar
- function - Flutter:如何更改其他函数中的本地值?
- python - 在 Python 刽子手游戏中遇到功能问题
- node.js - 是否可以将异步方法附加到猫鼬中异步插件中的模式?
- node.js - 在 Angular 11 中使用 NgSelect2Module 填充自定义数组
- java - Java android保持片段在后台运行
- php - Chrome Kaspersky 自动添加事件监听器导致验证码 SESSION['security variable'] 在后台更改