gpt4 book ai didi

docker-compose.yml : Why does restart "no" have to have quotation marks?

转载 作者:行者123 更新时间:2023-12-02 05:42:51 26 4
gpt4 key购买 nike

在 docker-compose ( https://docs.docker.com/compose/compose-file/#restart ) 的 docker 文档中给出了此重新启动选项:

restart: "no"
restart: always
restart: on-failure
restart: unless-stopped

我只是想知道,为什么“否”必须用引号引起来,而其他选项则不必? docker-compose 不能以 no 开头且不带引号。

最佳答案

原因是值 yesno 被评估为 truefalse。这就是为什么您需要使用双引号以便将其解释为字符串

请参阅http://www.yaml.org/refcard.html

关于docker-compose.yml : Why does restart "no" have to have quotation marks?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46233297/

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