Search code examples
dockerdocker-compose

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


In the docker docs for docker-compose (https://docs.docker.com/compose/compose-file/05-services/#restart) this restart options are given:

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

I'm just wondering, why the "no" has to be in quotation marks and the other options not? The docker-compose can't start with no without quotation marks.


Solution

  • The reason is values yes and no are evaluated as true or false. That is why you need to use double quotes so that it is interpreted as string

    Please see http://www.yaml.org/refcard.html