gpt4 book ai didi

Docker Swarm : restart-policy Additional property restart-policy is not allowed

转载 作者:行者123 更新时间:2023-12-02 17:51:06 27 4
gpt4 key购买 nike

鉴于以下(为了论证而简化)docker-compose.yml文件:

version: '3'

services:
postgres:
image: fleetit-postgres
deploy:
restart-policy:
condition: on-failure
ports:
- "5432:5432"
environment:
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "demo1234"
POSTGRES_DB: "fleetit"

我试图用命令部署一个堆栈
docker stack deploy -c docker-compose.yml stackdemo

但它只是给我抛出了错误
restart-policy Additional property restart-policy is not allowed

我究竟做错了什么?

这是我正在运行的 Docker 版本:
$ docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.10.1
Git commit: 3d479c0af6
Built: Tue Apr 17 22:46:17 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: 3d479c0af6
Built: Tue Apr 17 22:46:48 2018
OS/Arch: linux/amd64
Experimental: false

最佳答案

你有一个错字。它应该是 restart_policy用下划线代替 restart-policy .

关于Docker Swarm : restart-policy Additional property restart-policy is not allowed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50257112/

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