gpt4 book ai didi

docker - 错误 : Additional property db-migrator is not allowed

转载 作者:行者123 更新时间:2023-12-05 03:02:00 31 4
gpt4 key购买 nike

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

我收到错误信息:

db-migrator Additional property db-migrator is not allowed

docker-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

最佳答案

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:

关于docker - 错误 : Additional property db-migrator is not allowed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55273089/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com