In the docker docs for docker-compose (https://docs.docker.com/compose/compose-file/#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.
What does restart always do in Docker compose? Restarts all stopped and running services, or the specified services only. If you make changes to your compose.
Like the restart Docker command, Docker Compose includes the restart property to restart containers automatically.
This is the default policy for all containers created with docker run . always – Docker will ensure the container is always running. If the container stops, it will be immediately restarted.
This means that with the unless-stopped restart policy, if the container was running before the reboot, the container would be restarted once the system restarted. When an application within a Docker container exits, that container will be also halted.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With