docker-compose.yml:为什么重新启动“否”必须有引号?

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

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

我只是想知道,为什么“不”必须在引号和其他选项不是? docker写作不能没有引号没有引号。

原因是价值观yesno评价为truefalse 。 这就是为什么你需要使用双引号,以便它被解释为string

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